Ejemplo n.º 1
0
 public string LooseObjectStep()
 {
     return(this.CallGSD(
                "dehydrate \"" + this.enlistmentRoot + "\"",
                failOnError: true,
                internalParameter: GSDHelpers.GetInternalParameter("\\\"LooseObjects\\\"")));
 }
Ejemplo n.º 2
0
        public string PostFetchStep()
        {
            string internalParameter = GSDHelpers.GetInternalParameter("\\\"PostFetch\\\"");

            return(this.CallGSD(
                       "dehydrate \"" + this.enlistmentRoot + "\"",
                       failOnError: true,
                       internalParameter: internalParameter));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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);
            }
        }