public static GetCurrentBranchName ( bool trimPrefix ) : string | ||
trimPrefix | bool | |
return | string |
/// <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); }
public static void GetBranchName() => BranchName = GitHelper.GetCurrentBranchName(false);