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

Method ResetDefaultToCommit

reset.go:35–49  ·  view source on GitHub ↗
(commit *Commit, pathspecs []string)

Source from the content-addressed store, hash-verified

33}
34
35func (r *Repository) ResetDefaultToCommit(commit *Commit, pathspecs []string) error {
36 cpathspecs := C.git_strarray{}
37 cpathspecs.count = C.size_t(len(pathspecs))
38 cpathspecs.strings = makeCStringsFromStrings(pathspecs)
39 defer freeStrarray(&cpathspecs)
40
41 runtime.LockOSThread()
42 defer runtime.UnlockOSThread()
43 ret := C.git_reset_default(r.ptr, commit.ptr, &cpathspecs)
44
45 if ret < 0 {
46 return MakeGitError(ret)
47 }
48 return nil
49}

Callers

nothing calls this directly

Calls 3

makeCStringsFromStringsFunction · 0.85
freeStrarrayFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by

no test coverage detected