Add ReferenceNormalizeName #681

Merged
segevfiner merged 6 commits from git-reference-normalize-name into master 2020-11-13 18:51:00 -06:00
2 changed files with 1 additions and 4 deletions
Showing only changes of commit e69f003813 - Show all commits

View File

@ -504,9 +504,6 @@ const (
// characters and collapsing runs of adjacent slashes between name components // characters and collapsing runs of adjacent slashes between name components
// into a single slash. // into a single slash.
// //
// Once normalized, if the reference name is valid, it will be returned in the
// user allocated buffer.
//
// See git_reference_symbolic_create() for rules about valid names. // See git_reference_symbolic_create() for rules about valid names.
func ReferenceNormalizeName(name string, flags ReferenceFormat) (string, error) { func ReferenceNormalizeName(name string, flags ReferenceFormat) (string, error) {
cname := C.CString(name) cname := C.CString(name)

View File

@ -231,7 +231,7 @@ func TestReferenceNormalizeName(t *testing.T) {
checkFatal(t, err) checkFatal(t, err)
if ref != "refs/heads/master" { if ref != "refs/heads/master" {
t.Errorf("refs/heads//master should be normalized correctly") t.Errorf("ReferenceNormalizeName(%q) = %q; want %q", "refs/heads//master", ref, want)
} }
ref, err = ReferenceNormalizeName("master", ReferenceFormatAllowOnelevel|ReferenceFormatRefspecShorthand) ref, err = ReferenceNormalizeName("master", ReferenceFormatAllowOnelevel|ReferenceFormatRefspecShorthand)