t5510: ensure that the packed-refs file needs locking
commitb02c7646f4cc812a99ceb1264f95427d2d7996f8
authorPatrick Steinhardt <ps@pks.im>
Tue, 14 Nov 2023 08:58:38 +0000 (14 09:58 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 Nov 2023 01:12:12 +0000 (17 10:12 +0900)
tree6dbb157bc18fd51af4becb099c689860085ddfd0
parentcfb8a6e9a93adbe81efca66e6110c9b4d2e57169
t5510: ensure that the packed-refs file needs locking

One of the tests in t5510 asserts that a `git fetch --prune` detects
failures to prune branches. This is done by locking the packed-refs
file, which would then later lead to a locking issue when Git tries to
rewrite the file to prune the branches from it.

Interestingly though, we do not pack the about-to-be-pruned branch into
the packed-refs file, so it never even contained that branch in the
first place. While this is good enough right now because the pruning
will always lock the file regardless of whether it contains the branch
or not, this is a mere implementation detail. In fact, we're about to
rewrite branch deletions to make use of the ref transaction interface,
which knows to skip rewrites of the packed-refs file in the case where
it does not contain the branches in the first place, and this will break
the test.

Prepare the test for that change by packing the refs before trying to
prune them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5510-fetch.sh