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

Method AnnotatedCommitFromFetchHead

merge.go:45–65  ·  view source on GitHub ↗
(branchName string, remoteURL string, oid *Oid)

Source from the content-addressed store, hash-verified

43}
44
45func (r *Repository) AnnotatedCommitFromFetchHead(branchName string, remoteURL string, oid *Oid) (*AnnotatedCommit, error) {
46 cbranchName := C.CString(branchName)
47 defer C.free(unsafe.Pointer(cbranchName))
48
49 cremoteURL := C.CString(remoteURL)
50 defer C.free(unsafe.Pointer(cremoteURL))
51
52 runtime.LockOSThread()
53 defer runtime.UnlockOSThread()
54
55 var ptr *C.git_annotated_commit
56 ret := C.git_annotated_commit_from_fetchhead(&ptr, r.ptr, cbranchName, cremoteURL, oid.toC())
57 runtime.KeepAlive(oid)
58 if ret < 0 {
59 return nil, MakeGitError(ret)
60 }
61
62 annotatedCommit := newAnnotatedCommitFromC(ptr, r)
63 runtime.KeepAlive(r)
64 return annotatedCommit, nil
65}
66
67func (r *Repository) LookupAnnotatedCommit(oid *Oid) (*AnnotatedCommit, error) {
68 runtime.LockOSThread()

Callers

nothing calls this directly

Calls 4

MakeGitErrorFunction · 0.85
newAnnotatedCommitFromCFunction · 0.85
freeMethod · 0.80
toCMethod · 0.45

Tested by

no test coverage detected