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

Method Push

remote.go:1167–1190  ·  view source on GitHub ↗
(refspecs []string, opts *PushOptions)

Source from the content-addressed store, hash-verified

1165}
1166
1167func (o *Remote) Push(refspecs []string, opts *PushOptions) error {
1168 crefspecs := C.git_strarray{
1169 count: C.size_t(len(refspecs)),
1170 strings: makeCStringsFromStrings(refspecs),
1171 }
1172 defer freeStrarray(&crefspecs)
1173
1174 var err error
1175 coptions := populatePushOptions(&C.git_push_options{}, opts, &err)
1176 defer freePushOptions(coptions)
1177
1178 runtime.LockOSThread()
1179 defer runtime.UnlockOSThread()
1180
1181 ret := C.git_remote_push(o.ptr, &crefspecs, coptions)
1182 runtime.KeepAlive(o)
1183 if ret == C.int(ErrorCodeUser) && err != nil {
1184 return err
1185 }
1186 if ret < 0 {
1187 return MakeGitError(ret)
1188 }
1189 return nil
1190}
1191
1192func (o *Remote) PruneRefs() bool {
1193 return C.git_remote_prune_refs(o.ptr) > 0

Callers

nothing calls this directly

Calls 5

makeCStringsFromStringsFunction · 0.85
freeStrarrayFunction · 0.85
populatePushOptionsFunction · 0.85
freePushOptionsFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by

no test coverage detected