private bool TryFetchUsingGitProtocol(GitProcess gitProcess, out string error) { this.LastRunTimeFilePath = Path.Combine(this.Context.Enlistment.ScalarLogsRoot, FetchTimeFile); if (!this.forceRun && !this.EnoughTimeBetweenRuns()) { this.Context.Tracer.RelatedInfo($"Skipping {nameof(FetchStep)} due to not enough time between runs"); error = null; return(true); } using (ITracer activity = this.Context.Tracer.StartActivity(nameof(GitProcess.BackgroundFetch), EventLevel.LogAlways)) { if (!gitProcess.TryGetRemotes(out string[] remotes, out string errors)) { error = $"Failed to load remotes with error: {errors}"; activity.RelatedError(error); return(false); } bool response = true; error = ""; foreach (string remote in remotes) { activity.RelatedInfo($"Running fetch for remote '{remote}'"); GitProcess.Result result = gitProcess.BackgroundFetch(remote); if (!string.IsNullOrWhiteSpace(result.Output)) { activity.RelatedError($"Background fetch from '{remote}' completed with stdout: {result.Output}"); } if (!string.IsNullOrWhiteSpace(result.Errors)) { error += result.Errors; activity.RelatedError($"Background fetch from '{remote}' completed with stderr: {result.Errors}"); } if (result.ExitCodeIsFailure) { response = false; // Keep going through other remotes, but the overall result will still be false. activity.RelatedError($"Background fetch from '{remote}' failed"); } } this.SaveLastRunTimeToFile(); return(response); } }