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.
This commit is contained in:
Carlos Martín Nieto 2019-01-04 13:18:54 +00:00
parent bcf325244c
commit f969cc900d
2 changed files with 22 additions and 6 deletions

View File

@ -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)
treeId, err := idx.WriteTreeTo(repo2)
id, err := odb.Write(content, ObjectBlob)
checkFatal(t, err)
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" {

2
vendor/libgit2 vendored

@ -1 +1 @@
Subproject commit 838a2f2918b6d9fad8768d2498575ff5d75c35f0
Subproject commit fba70a9d5f1fa433968a3dfd51e3153c8eebe834