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

Method EnsureLog

reference.go:105–119  ·  view source on GitHub ↗

EnsureLog ensures that there is a reflog for the given reference name and creates an empty one if necessary.

(name string)

Source from the content-addressed store, hash-verified

103// EnsureLog ensures that there is a reflog for the given reference
104// name and creates an empty one if necessary.
105func (c *ReferenceCollection) EnsureLog(name string) error {
106 cname := C.CString(name)
107 defer C.free(unsafe.Pointer(cname))
108
109 runtime.LockOSThread()
110 defer runtime.UnlockOSThread()
111
112 ret := C.git_reference_ensure_log(c.repo.ptr, cname)
113 runtime.KeepAlive(c)
114 if ret < 0 {
115 return MakeGitError(ret)
116 }
117
118 return nil
119}
120
121// HasLog returns whether there is a reflog for the given reference
122// name

Callers

nothing calls this directly

Calls 2

MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected