GetCurrentBranchName() public static method

public static GetCurrentBranchName ( bool trimPrefix ) : string
trimPrefix bool
return string
Ejemplo n.º 1
0
        /// <summary>
        /// Get the Git branch name eg. 'feature/tgit'
        /// </summary>
        /// <remarks>Cached for 15s</remarks>
        /// <returns></returns>
        private string GetBranchName()
        {
            if (_cache.Contains(CacheKeyEnum.BranchName.ToString()))
            {
                return(_cache.Get(CacheKeyEnum.BranchName.ToString()).ToString());
            }

            var branchName = GitHelper.GetCurrentBranchName(false, this);

            if (!string.IsNullOrEmpty(branchName))
            {
                _cache.Set(CacheKeyEnum.BranchName.ToString(), branchName, DateTimeOffset.Now.AddSeconds(15));
            }
            return(branchName);
        }
Ejemplo n.º 2
0
 public static void GetBranchName() => BranchName = GitHelper.GetCurrentBranchName(false);