Beispiel #1
0
        /// <summary>Returns git version.</summary>
        /// <returns>git version.</returns>
        private Version QueryVersion()
        {
            var gitOutput = CommandExecutor.ExecuteCommand(
                new Command("--version"),
                CommandExecutionFlags.None);

            gitOutput.ThrowOnBadReturnCode();
            var parser = new GitParser(gitOutput.Output);

            return(parser.ReadVersion());
        }
Beispiel #2
0
        public static Version CheckVersion(string gitExe)
        {
            var stdErrReceiver = new AsyncTextReader();
            var stdOutReceiver = new AsyncTextReader();
            var executor       = new GitProcessExecutor(gitExe);
            var exitCode       = executor.Execute(new GitInput(new Command("--version")), stdOutReceiver, stdErrReceiver);
            var output         = new GitOutput(stdOutReceiver.GetText(), stdErrReceiver.GetText(), exitCode);

            output.ThrowOnBadReturnCode();
            var parser = new GitParser(output.Output);

            return(parser.ReadVersion());
        }
Beispiel #3
0
 public static Version CheckVersion(string gitExe)
 {
     var stdErrReceiver = new AsyncTextReader();
     var stdOutReceiver = new AsyncTextReader();
     var executor = new GitProcessExecutor(gitExe);
     var exitCode = executor.Execute(new GitInput(new Command("--version")), stdOutReceiver, stdErrReceiver);
     var output = new GitOutput(stdOutReceiver.GetText(), stdErrReceiver.GetText(), exitCode);
     output.ThrowOnBadReturnCode();
     var parser = new GitParser(output.Output);
     return parser.ReadVersion();
 }