StartProcessGitResult() public static method

Execute a Git command and return the output
public static StartProcessGitResult ( string commands ) : Task
commands string Git command to be executed
return Task
Esempio n. 1
0
        public static string GetCurrentBranchName(bool trimPrefix, EnvHelper envHelper)
        {
            var branchName = ProcessHelper.StartProcessGitResult(envHelper, "symbolic-ref -q --short HEAD");

            if (branchName == null)
            {
                return(string.Empty);
            }

            var gitConfig = GetGitConfig(envHelper);

            if (branchName.StartsWith(gitConfig.FeaturePrefix) && trimPrefix)
            {
                return(branchName.Substring(gitConfig.FeaturePrefix.Length));
            }
            if (branchName.StartsWith(gitConfig.ReleasePrefix) && trimPrefix)
            {
                return(branchName.Substring(gitConfig.ReleasePrefix.Length));
            }
            if (branchName.StartsWith(gitConfig.HotfixPrefix) && trimPrefix)
            {
                return(branchName.Substring(gitConfig.HotfixPrefix.Length));
            }

            return(branchName);
        }
Esempio n. 2
0
        public static string GetSshSetup(EnvHelper envHelper)
        {
            var remoteOriginPuttyKeyfile = ProcessHelper.StartProcessGitResult(envHelper, "config --get remote.origin.puttykeyfile");

            if (string.IsNullOrEmpty(remoteOriginPuttyKeyfile))
            {
                return(string.Empty);
            }

            ProcessHelper.Start("pageant", remoteOriginPuttyKeyfile);
            return($"set GIT_SSH={FileHelper.GetTortoiseGitPlink()} && ");
        }
Esempio n. 3
0
        /// <summary>
        /// Get GIT config.
        /// </summary>
        /// <remarks>
        /// - Cache received config based on the currently opened solution file path.
        /// - If the solution file path is different from last time we got the git config,
        ///   it means we have a new solution and should also get new git config.
        /// </remarks>
        /// <returns>Strong typed GIT config about gitflow, svn and bugtraq.</returns>
        public static async Task <GitConfig> GetGitConfig()
        {
            var solution = await VS.Solutions.GetCurrentSolutionAsync();

            if (_gitConfig == null ||
                string.IsNullOrEmpty(_solutionFullPath) ||
                !_solutionFullPath.Equals(solution?.FullPath))
            {
                _gitConfig        = new GitConfig(await ProcessHelper.StartProcessGitResult("config --get-regexp \"gitflow|bugtraq|svn-remote\""));
                _solutionFullPath = solution?.FullPath;
            }

            return(_gitConfig);
        }
Esempio n. 4
0
 public static GitConfig GetGitConfig(EnvHelper envHelper)
 {
     return(new GitConfig(ProcessHelper.StartProcessGitResult(envHelper, "config --get-regexp \"gitflow|bugtraq|svn-remote\"")));
 }
Esempio n. 5
0
 public static GitConfig GetGitConfig()
 {
     return(new GitConfig(ProcessHelper.StartProcessGitResult("config --get-regexp gitflow")));
 }