From 1c1346d3646888974db20511bdecec992425db8b Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Sun, 3 Sep 2017 16:50:07 +0200 Subject: Update vendored libgit2 to latest --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index df4dfaa..3c21645 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit df4dfaadcf709646ebab2e57e3589952cf1ac809 +Subproject commit 3c21645360a0b06d6ed5f028e9517d65f8e11bc1 -- cgit v1.2.3 From 0ebe7220d7d82629168f03eb9d3257ee1476cca9 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Sun, 3 Sep 2017 19:49:30 +0200 Subject: Go back to the v0.26 libgit2 release Newer commits have changed the build scripts such that the HTTP parser is not included in the static library. This also reverts commit ecf4f7a137ba69014d414b8de20eb58e115bfd73. --- patch.go | 2 +- vendor/libgit2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'vendor/libgit2') diff --git a/patch.go b/patch.go index 7e6f71d..75e843c 100644 --- a/patch.go +++ b/patch.go @@ -69,7 +69,7 @@ func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf [] var patchPtr *C.git_patch oldPtr := toPointer(oldBuf) - newPtr := toPointer(newBuf) + newPtr := (*C.char)(toPointer(newBuf)) cOldPath := C.CString(oldPath) defer C.free(unsafe.Pointer(cOldPath)) diff --git a/vendor/libgit2 b/vendor/libgit2 index 3c21645..15e1193 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 3c21645360a0b06d6ed5f028e9517d65f8e11bc1 +Subproject commit 15e119375018fba121cf58e02a9f17fe22df0df8 -- cgit v1.2.3 From 028ea07d77bb72265a179710e1461caa8e988d1b Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Fri, 29 Sep 2017 09:41:46 +0200 Subject: Bump libgit2 to c7c5f2c4ec --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 15e1193..c7c5f2c 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 15e119375018fba121cf58e02a9f17fe22df0df8 +Subproject commit c7c5f2c4ecc727ac555f51bd20353f7f3ae9c07a -- cgit v1.2.3 From ec5d2bee0ffbea5a6d952d74e37e766366b5a316 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Wed, 17 Jan 2018 11:43:25 +0000 Subject: Bump libgit2 to f1323d9c --- config.go | 2 +- vendor/libgit2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'vendor/libgit2') diff --git a/config.go b/config.go index c19ad32..ab9af38 100644 --- a/config.go +++ b/config.go @@ -77,7 +77,7 @@ func (c *Config) AddFile(path string, level ConfigLevel, force bool) error { runtime.LockOSThread() defer runtime.UnlockOSThread() - ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), cbool(force)) + ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), nil, cbool(force)) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) diff --git a/vendor/libgit2 b/vendor/libgit2 index c7c5f2c..f1323d9 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit c7c5f2c4ecc727ac555f51bd20353f7f3ae9c07a +Subproject commit f1323d9c161aeeada190fd9615a8b5a9fb8a7f3e -- cgit v1.2.3 From ec429ccdfc54141e30dd829020fc8fa2927e690c Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Thu, 22 Feb 2018 09:07:57 +0100 Subject: vendor: bump libgit2 to 809b0ca6b (v0.27.0-rc1) --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index f1323d9..809b0ca 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit f1323d9c161aeeada190fd9615a8b5a9fb8a7f3e +Subproject commit 809b0ca6b9b6a5648b8e802a9f0c6a0821257595 -- cgit v1.2.3 From 304d67b0fb5042f0df73e1868be543c9ecab1026 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Mon, 26 Mar 2018 12:21:20 +0200 Subject: vendor: update libgit2 to v0.27.0 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 809b0ca..6311e88 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 809b0ca6b9b6a5648b8e802a9f0c6a0821257595 +Subproject commit 6311e886d8b5377c6037cd9937ccf66a71f3361d -- cgit v1.2.3 From 925932a54fb021a972c68d6f4b43d31684c1ffb8 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Tue, 29 May 2018 21:09:45 +0200 Subject: vendor: bump libgit2 to 7f6c1ce9760c6 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 6311e88..7f6c1ce 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 6311e886d8b5377c6037cd9937ccf66a71f3361d +Subproject commit 7f6c1ce9760c6c397e94d4eba506faeb95452702 -- cgit v1.2.3 From 973938cbb5539c7ee7eec3b9895a66f502b16604 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Wed, 8 Aug 2018 11:45:48 +0200 Subject: Bump vendored libgit2 to 9275d84c583 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 7f6c1ce..9275d84 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 7f6c1ce9760c6c397e94d4eba506faeb95452702 +Subproject commit 9275d84c583a030e759edbfafacf99c42a83c543 -- cgit v1.2.3 From 92501bd663509b4fd3c4796ff99d056eb8818fae Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Sun, 7 Oct 2018 18:50:25 +0200 Subject: Update vendored libgit2 to 838a2f291 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 9275d84..838a2f2 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 9275d84c583a030e759edbfafacf99c42a83c543 +Subproject commit 838a2f2918b6d9fad8768d2498575ff5d75c35f0 -- cgit v1.2.3 From f969cc900dde4ba92c814823bc004bd1870079a9 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Fri, 4 Jan 2019 13:18:54 +0000 Subject: Bump vendored libgit2 to fba70a9d5f This includes updating the `Index.WriteTreeTo` test as it was abusing an oversight of the object creation safety checks and creating a tree referencing a non-existent blob. Instead we update it to the primary purpose of this method which is to write into a repository from an unattached index. --- index_test.go | 26 +++++++++++++++++++++----- vendor/libgit2 | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'vendor/libgit2') diff --git a/index_test.go b/index_test.go index f47dace..43644fa 100644 --- a/index_test.go +++ b/index_test.go @@ -3,6 +3,7 @@ package git import ( "io/ioutil" "os" + "path" "runtime" "testing" ) @@ -59,14 +60,29 @@ func TestIndexWriteTreeTo(t *testing.T) { repo := createTestRepo(t) defer cleanupTestRepo(t, repo) - repo2 := createTestRepo(t) - defer cleanupTestRepo(t, repo2) + idx, err := NewIndex() + checkFatal(t, err) - idx, err := repo.Index() + odb, err := repo.Odb() checkFatal(t, err) - err = idx.AddByPath("README") + + content, err := ioutil.ReadFile(path.Join(repo.Workdir(), "README")) + checkFatal(t, err) + + id, err := odb.Write(content, ObjectBlob) checkFatal(t, err) - treeId, err := idx.WriteTreeTo(repo2) + + err = idx.Add(&IndexEntry{ + Mode: FilemodeBlob, + Uid: 0, + Gid: 0, + Size: uint32(len(content)), + Id: id, + Path: "README", + }) + checkFatal(t, err) + + treeId, err := idx.WriteTreeTo(repo) checkFatal(t, err) if treeId.String() != "b7119b11e8ef7a1a5a34d3ac87f5b075228ac81e" { diff --git a/vendor/libgit2 b/vendor/libgit2 index 838a2f2..fba70a9 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 838a2f2918b6d9fad8768d2498575ff5d75c35f0 +Subproject commit fba70a9d5f1fa433968a3dfd51e3153c8eebe834 -- cgit v1.2.3 From 5fda6dd90191b1c51a1785ad7cabd2fd5b05e802 Mon Sep 17 00:00:00 2001 From: lhchavez Date: Sat, 12 Jan 2019 21:21:20 +0000 Subject: Uprev vendored libgit2 to v0.28 New version is here! --- git_static.go | 4 ++-- object.go | 16 ++++++++-------- odb.go | 2 +- vendor/libgit2 | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'vendor/libgit2') diff --git a/git_static.go b/git_static.go index 547ae8a..d7c2295 100644 --- a/git_static.go +++ b/git_static.go @@ -8,8 +8,8 @@ package git #cgo !windows pkg-config: --static ${SRCDIR}/static-build/install/lib/pkgconfig/libgit2.pc #include -#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 27 -# error "Invalid libgit2 version; this git2go supports libgit2 v0.27" +#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 28 +# error "Invalid libgit2 version; this git2go supports libgit2 v0.28" #endif */ diff --git a/object.go b/object.go index 40ab2bf..2d75b06 100644 --- a/object.go +++ b/object.go @@ -13,12 +13,12 @@ import ( type ObjectType int const ( - ObjectAny ObjectType = C.GIT_OBJECT_ANY - ObjectBad ObjectType = C.GIT_OBJECT_BAD - ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT - ObjectTree ObjectType = C.GIT_OBJECT_TREE - ObjectBlob ObjectType = C.GIT_OBJECT_BLOB - ObjectTag ObjectType = C.GIT_OBJECT_TAG + ObjectAny ObjectType = C.GIT_OBJECT_ANY + ObjectInvalid ObjectType = C.GIT_OBJECT_INVALID + ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT + ObjectTree ObjectType = C.GIT_OBJECT_TREE + ObjectBlob ObjectType = C.GIT_OBJECT_BLOB + ObjectTag ObjectType = C.GIT_OBJECT_TAG ) type Object struct { @@ -35,8 +35,8 @@ func (t ObjectType) String() string { switch t { case ObjectAny: return "Any" - case ObjectBad: - return "Bad" + case ObjectInvalid: + return "Invalid" case ObjectCommit: return "Commit" case ObjectTree: diff --git a/odb.go b/odb.go index 5768cf4..fec0eb9 100644 --- a/odb.go +++ b/odb.go @@ -66,7 +66,7 @@ func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) { ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC()) runtime.KeepAlive(v) if ret < 0 { - return 0, ObjectBad, MakeGitError(ret) + return 0, ObjectInvalid, MakeGitError(ret) } return uint64(sz), ObjectType(cotype), nil diff --git a/vendor/libgit2 b/vendor/libgit2 index fba70a9..1a107fa 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit fba70a9d5f1fa433968a3dfd51e3153c8eebe834 +Subproject commit 1a107fac0fc88a4d74b64ffc9ae2fd178ba631c0 -- cgit v1.2.3 From b7eeb4f405c194fbff145eb8c5f19ec6157c38d7 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Tue, 13 Aug 2019 19:30:16 +0200 Subject: Update vendored libgit2 to 08cfa43d0e1a921 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 1a107fa..08cfa43 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 1a107fac0fc88a4d74b64ffc9ae2fd178ba631c0 +Subproject commit 08cfa43d0e1a9214a2f1239593686078e75e5636 -- cgit v1.2.3 From 93a1ee401f5b924a23a43d1499b0516ce455e59d Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Tue, 10 Dec 2019 21:28:24 +0000 Subject: Bump libgit2 to 6777db8e83 --- vendor/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor/libgit2') diff --git a/vendor/libgit2 b/vendor/libgit2 index 08cfa43..6777db8 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 08cfa43d0e1a9214a2f1239593686078e75e5636 +Subproject commit 6777db8e8343014d57c41b335e0c60af44d4e9f2 -- cgit v1.2.3 From 419bac9075cd0967b09f4e0f9884a1d87298c2e3 Mon Sep 17 00:00:00 2001 From: lhchavez Date: Thu, 13 Feb 2020 03:06:01 +0000 Subject: 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 --- mempack.go | 13 ++++++++++--- vendor/libgit2 | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'vendor/libgit2') 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 } diff --git a/vendor/libgit2 b/vendor/libgit2 index 6777db8..ee3307a 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 6777db8e8343014d57c41b335e0c60af44d4e9f2 +Subproject commit ee3307a183e39d602b25fa94831c6fc09e7c1b61 -- cgit v1.2.3