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

Method AheadBehind

graph.go:26–42  ·  view source on GitHub ↗
(local, upstream *Oid)

Source from the content-addressed store, hash-verified

24}
25
26func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error) {
27 runtime.LockOSThread()
28 defer runtime.UnlockOSThread()
29
30 var aheadT C.size_t
31 var behindT C.size_t
32
33 ret := C.git_graph_ahead_behind(&aheadT, &behindT, repo.ptr, local.toC(), upstream.toC())
34 runtime.KeepAlive(repo)
35 runtime.KeepAlive(local)
36 runtime.KeepAlive(upstream)
37 if ret < 0 {
38 return 0, 0, MakeGitError(ret)
39 }
40
41 return int(aheadT), int(behindT), nil
42}
43
44// ReachableFromAny returns whether a commit is reachable from any of a list of
45// commits by following parent edges.

Callers

nothing calls this directly

Calls 2

MakeGitErrorFunction · 0.85
toCMethod · 0.45

Tested by

no test coverage detected