summaryrefslogtreecommitdiff
path: root/mempack.go
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-02-13 03:06:01 +0000
committerlhchavez <[email protected]>2020-02-20 19:01:59 -0800
commit419bac9075cd0967b09f4e0f9884a1d87298c2e3 (patch)
tree621406936e9a78159ebb7a90da072580d78d4b45 /mempack.go
parentf21ecd9e74314585b26c08ddb6ea674d7b0bcca4 (diff)
Uprev libgit2
This uprevs libgit2 to the latest and greatest. Notably, * Fixes the interface of `git_mempack_reset`, since it now returns an `int` instead of being `void`. Fixes: #533
Diffstat (limited to 'mempack.go')
-rw-r--r--mempack.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/mempack.go b/mempack.go
index 337e67d..bdea224 100644
--- a/mempack.go
+++ b/mempack.go
@@ -6,7 +6,7 @@ package git
extern int git_mempack_new(git_odb_backend **out);
extern int git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *backend);
-extern void git_mempack_reset(git_odb_backend *backend);
+extern int git_mempack_reset(git_odb_backend *backend);
extern void _go_git_odb_backend_free(git_odb_backend *backend);
*/
import "C"
@@ -79,6 +79,13 @@ func (mempack *Mempack) Dump(repository *Repository) ([]byte, error) {
//
// This assumes that Mempack.Dump has been called before to store all the
// queued objects into a single packfile.
-func (mempack *Mempack) Reset() {
- C.git_mempack_reset(mempack.ptr)
+func (mempack *Mempack) Reset() error {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_mempack_reset(mempack.ptr)
+ if ret < 0 {
+ return MakeGitError(ret)
+ }
+ return nil
}