diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-08-29 13:56:58 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2019-10-21 18:48:53 +0300 |
commit | ab00b76d2a032b13e66e6e9dd06df8392bf17cf1 (patch) | |
tree | fa8af4df902688ef6e25e52bff6694444e038311 | |
parent | dbd87c628e521ce967fe1e86d68059e44b4f5fb6 (diff) |
Add back fsck sanity check
-rw-r--r-- | internal/git/objectpool/fetch_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/git/objectpool/fetch_test.go b/internal/git/objectpool/fetch_test.go index 1bbea2685..354a79ba2 100644 --- a/internal/git/objectpool/fetch_test.go +++ b/internal/git/objectpool/fetch_test.go @@ -90,6 +90,17 @@ func TestFetchFromOriginKeepUnreachableObjects(t *testing.T) { // Deleting the ref should fix that. testhelper.MustRunCommand(t, nil, "git", append(baseArgs, "update-ref", "-d", "refs/tags/"+newTagName)...) + fsckBefore := testhelper.MustRunCommand(t, nil, "git", append(baseArgs, "fsck", "--connectivity-only", "--dangling")...) + fsckBeforeLines := strings.Split(string(fsckBefore), "\n") + for _, l := range []string{ + fmt.Sprintf("dangling blob %s", newBlob), + fmt.Sprintf("dangling tree %s", newTree), + fmt.Sprintf("dangling commit %s", newCommit), + fmt.Sprintf("dangling tag %s", newTag), + } { + require.Contains(t, fsckBeforeLines, l, "test setup sanity check") + } + unreachableObjectsExist := func(msg string) { for _, oid := range []string{newBlob, newTree, newCommit, newTag} { check := exec.Command("git", "cat-file", "-e", oid) |