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();
}