public string LooseObjectStep() { return(this.CallGSD( "dehydrate \"" + this.enlistmentRoot + "\"", failOnError: true, internalParameter: GSDHelpers.GetInternalParameter("\\\"LooseObjects\\\""))); }
public string PostFetchStep() { string internalParameter = GSDHelpers.GetInternalParameter("\\\"PostFetch\\\""); return(this.CallGSD( "dehydrate \"" + this.enlistmentRoot + "\"", failOnError: true, internalParameter: internalParameter)); }
public string PackfileMaintenanceStep(long?batchSize) { string sizeString = batchSize.HasValue ? $"\\\"{batchSize.Value}\\\"" : "null"; string internalParameter = GSDHelpers.GetInternalParameter("\\\"PackfileMaintenance\\\"", sizeString); return(this.CallGSD( "dehydrate \"" + this.enlistmentRoot + "\"", failOnError: true, internalParameter: internalParameter)); }
private string CallGSD(string args, bool failOnError = false, string trace = null, string standardInput = null, string internalParameter = null) { ProcessStartInfo processInfo = null; processInfo = new ProcessStartInfo(this.pathToGSD); if (internalParameter == null) { internalParameter = GSDHelpers.GetInternalParameter(); } processInfo.Arguments = args + " " + TestConstants.InternalUseOnlyFlag + " " + internalParameter; processInfo.WindowStyle = ProcessWindowStyle.Hidden; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; if (standardInput != null) { processInfo.RedirectStandardInput = true; } if (trace != null) { processInfo.EnvironmentVariables["GIT_TRACE"] = trace; } using (Process process = Process.Start(processInfo)) { if (standardInput != null) { process.StandardInput.Write(standardInput); process.StandardInput.Close(); } string result = process.StandardOutput.ReadToEnd(); process.WaitForExit(); if (failOnError) { process.ExitCode.ShouldEqual(0, result); } return(result); } }