From 5cd40aec7eadcefc3d9952663327fde035b48a20 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 4 Jul 2023 10:09:44 +0200 Subject: 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. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ed9b6ec15..24ba59c41 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.3