diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-07-04 11:09:44 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-07-04 11:15:26 +0300 |
commit | 5cd40aec7eadcefc3d9952663327fde035b48a20 (patch) | |
tree | e40049af7b4b9f96c2d307eb0db6df2d87305b60 /Makefile | |
parent | 25fbd040740121576144a38413229d2cc571aca6 (diff) |
Makefile: Fix test repository state depending on host Git version
While deprecated, many tests still depend on the `gitlab-test.git` test
repository. This repository is getting cloned in our Makefile with the
host Git version and is thus subject to whatever Git version the system
got installed.
With Git v2.41, reverse indices have been enabled by default, which
causes git-clone(1) to write an additional `.rev` file into the repo's
object database. And given that we use the local transport in our test
helpers to set up the seeded test repository, the consequence is that
this file also ends up in the cloned test repo, which ultimately ends up
causing a test failure:
=== FAIL: internal/gitaly/service/smarthttp TestPostReceivePack_packfiles (1.08s)
receive_pack_test.go:261:
Error Trace: .../internal/gitaly/service/smarthttp/receive_pack_test.go:261
Error: Should be empty, but was [/tmp/gitaly-446142327/309375621/storages.d/default/@hashed/31/48/31482fd7627141e518a13db4a1e7815044a2e7bfad7b141bd71a2276d9375aa4.git/objects/pack/pack-96123679492d2e0a3bf6a4477532c7e969fdeda4.rev]
Test: TestPostReceivePack_packfiles
DONE 74 tests, 1 skipped, 1 failure in 4.290s
Fix this dependence on the host Git version by explicitly asking Git to
not write reverse indices when we create the test repository.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -720,7 +720,8 @@ ${PROTOC_GEN_DOC}: TOOL_PACKAGE = github.com/pseudomuto/protoc-gen-doc/cmd/pr ${DELVE}: TOOL_PACKAGE = github.com/go-delve/delve/cmd/dlv ${TEST_REPO}: - ${GIT} clone --bare ${GIT_QUIET} https://gitlab.com/gitlab-org/gitlab-test.git $@ + # Skip writing the reverse index as otherwise our tests will get confused. + ${GIT} -c pack.writeReverseIndex=false clone --bare ${GIT_QUIET} https://gitlab.com/gitlab-org/gitlab-test.git $@ @ # Git notes aren't fetched by default with git clone ${GIT} -C $@ fetch ${GIT_QUIET} origin refs/notes/*:refs/notes/* ${Q}rm -rf $@/refs |