Add ReferenceNormalizeName #681
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue