init-branch : Update libgit2sharp to use IsValidName()

This commit is contained in:
Philippe Miossec
2012-11-16 18:16:49 +01:00
parent 5a5c7c3812
commit 3bf9fa4fb5
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -408,10 +408,9 @@ namespace Sep.Git.Tfs.Core
public string AssertValidBranchName(string gitBranchName)
{
var newGitBranchName = CommandOneline("check-ref-format", "--branch", gitBranchName);
if (string.IsNullOrWhiteSpace(newGitBranchName) || newGitBranchName.IndexOf("fatal:") == 0)
if (!_repository.Refs.IsValidName("refs/heads/" + gitBranchName))
throw new GitTfsException("The name specified for the new git branch is not allowed. Choose another one!");
return newGitBranchName.Trim();
return gitBranchName;
}
public bool CreateBranch(string gitBranchName, string target)