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

Function ParseRefspec

refspec.go:18–35  ·  view source on GitHub ↗

ParseRefspec parses a given refspec string

(input string, isFetch bool)

Source from the content-addressed store, hash-verified

16
17// ParseRefspec parses a given refspec string
18func ParseRefspec(input string, isFetch bool) (*Refspec, error) {
19 var ptr *C.git_refspec
20
21 cinput := C.CString(input)
22 defer C.free(unsafe.Pointer(cinput))
23
24 runtime.LockOSThread()
25 defer runtime.UnlockOSThread()
26
27 ret := C.git_refspec_parse(&ptr, cinput, cbool(isFetch))
28 if ret < 0 {
29 return nil, MakeGitError(ret)
30 }
31
32 spec := &Refspec{ptr: ptr}
33 runtime.SetFinalizer(spec, (*Refspec).Free)
34 return spec, nil
35}
36
37// Free releases a refspec object which has been created by ParseRefspec
38func (s *Refspec) Free() {

Callers 1

TestRefspecFunction · 0.85

Calls 3

cboolFunction · 0.85
MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by 1

TestRefspecFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…