From ff1c872b3c8ffc59b7a2032fdf51bb76debcaf0e Mon Sep 17 00:00:00 2001 From: Jason Song Date: Wed, 7 Aug 2024 16:50:45 +0800 Subject: [PATCH 1/3] chore: add TAGS to TEST_TAGS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 378de6e8f41e0..0f72f9767342f 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ TAGS ?= TAGS_SPLIT := $(subst $(COMMA), ,$(TAGS)) TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags -TEST_TAGS ?= sqlite sqlite_unlock_notify +TEST_TAGS ?= $(TAGS_SPLIT) sqlite sqlite_unlock_notify TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR) From d58f14675ac5658f533cc76708cead0994947438 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Wed, 7 Aug 2024 17:35:52 +0800 Subject: [PATCH 2/3] test: skip sha256 for gogit --- modules/git/blame_sha256_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/git/blame_sha256_test.go b/modules/git/blame_sha256_test.go index 8cd345714f30b..da451f22fc5e1 100644 --- a/modules/git/blame_sha256_test.go +++ b/modules/git/blame_sha256_test.go @@ -14,6 +14,11 @@ func TestReadingBlameOutputSha256(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + if isGogit { + t.Skip("Skipping test since gogit does not support sha256") + return + } + t.Run("Without .git-blame-ignore-revs", func(t *testing.T) { repo, err := OpenRepository(ctx, "./tests/repos/repo5_pulls_sha256") assert.NoError(t, err) From 89740b4cf59bf237834ce99ccf64104be2c6bd87 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Wed, 7 Aug 2024 18:08:28 +0800 Subject: [PATCH 3/3] fix: getTree --- modules/git/repo_tree_gogit.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/git/repo_tree_gogit.go b/modules/git/repo_tree_gogit.go index dc97ce13441c9..651794a5aafbe 100644 --- a/modules/git/repo_tree_gogit.go +++ b/modules/git/repo_tree_gogit.go @@ -6,11 +6,20 @@ package git -import "github.com/go-git/go-git/v5/plumbing" +import ( + "errors" + + "github.com/go-git/go-git/v5/plumbing" +) func (repo *Repository) getTree(id ObjectID) (*Tree, error) { gogitTree, err := repo.gogitRepo.TreeObject(plumbing.Hash(id.RawValue())) if err != nil { + if errors.Is(err, plumbing.ErrObjectNotFound) { + return nil, ErrNotExist{ + ID: id.String(), + } + } return nil, err }