MCPcopy Create free account
hub / github.com/libgit2/git2go / Transform

Method Transform

refspec.go:113–129  ·  view source on GitHub ↗

Transform a reference to its target following the refspec's rules

(refname string)

Source from the content-addressed store, hash-verified

111
112// Transform a reference to its target following the refspec's rules
113func (s *Refspec) Transform(refname string) (string, error) {
114 buf := C.git_buf{}
115
116 cname := C.CString(refname)
117 defer C.free(unsafe.Pointer(cname))
118
119 runtime.LockOSThread()
120 defer runtime.UnlockOSThread()
121
122 ret := C.git_refspec_transform(&buf, s.ptr, cname)
123 if ret < 0 {
124 return "", MakeGitError(ret)
125 }
126 defer C.git_buf_dispose(&buf)
127
128 return C.GoString(buf.ptr), nil
129}
130
131// Rtransform converts a target reference to its source reference following the
132// refspec's rules

Callers 1

TestRefspecFunction · 0.80

Calls 2

MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by 1

TestRefspecFunction · 0.64