Sep.Git.Tfs.Commands.Ext.ToGitBranchNameFromTfsRepositoryPath C# (CSharp) Method

ToGitBranchNameFromTfsRepositoryPath() public static method

public static ToGitBranchNameFromTfsRepositoryPath ( this tfsRepositoryPath, bool includeTeamProjectName = false ) : string
tfsRepositoryPath this
includeTeamProjectName bool
return string
        public static string ToGitBranchNameFromTfsRepositoryPath(this string tfsRepositoryPath, bool includeTeamProjectName = false)
        {
            if (includeTeamProjectName)
            {
                return tfsRepositoryPath
                    .Replace("$/", string.Empty)
                    .ToGitRefName();
            }

            string gitBranchNameExpected = tfsRepositoryPath.IndexOf("$/") == 0
                ? tfsRepositoryPath.Remove(0, tfsRepositoryPath.IndexOf('/', 2) + 1)
                : tfsRepositoryPath;

            return gitBranchNameExpected.ToGitRefName();
        }