aboutsummaryrefslogtreecommitdiff
path: root/t/t3210-pack-refs.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-08-23 01:27:07 -0400
committerJunio C Hamano <gitster@pobox.com>2014-08-25 12:19:50 -0700
commitafd11d3ebcfb18c29840dfa68be32c5215810a77 (patch)
tree1cc5fd232b72e6c8e10f0650788b290c37099710 /t/t3210-pack-refs.sh
parent32f56600bb6ac6fc57183e79d2c1515dfa56672f (diff)
downloadgit-afd11d3ebcfb18c29840dfa68be32c5215810a77.tar.gz
git-afd11d3ebcfb18c29840dfa68be32c5215810a77.tar.xz
pack-refs: prune top-level refs like "refs/foo"
After we have packed all refs, we prune any loose refs that correspond to what we packed. We do so by first taking a lock with lock_ref_sha1, and then deleting the loose ref file. However, lock_ref_sha1 will refuse to take a lock on any refs that exist at the top-level of the "refs/" directory, and we skip pruning the ref. This is almost certainly not what we want to happen here. The criteria to be pruned should not differ from that to be packed; if a ref makes it to prune_ref, it's because we want it both packed and pruned (if there are refs you do not want to be packed, they should be omitted much earlier by pack_ref_is_possible, which we do in this case if --all is not given). We can fix this by switching to lock_any_ref_for_update. This behaves exactly the same with the exception of this top-level check. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3210-pack-refs.sh')
-rwxr-xr-xt/t3210-pack-refs.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 1a2080e3d..3a017bf43 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -151,4 +151,11 @@ test_expect_success 'delete ref while another dangling packed ref' '
test_cmp /dev/null result
'
+test_expect_success 'pack ref directly below refs/' '
+ git update-ref refs/top HEAD &&
+ git pack-refs --all --prune &&
+ grep refs/top .git/packed-refs &&
+ test_path_is_missing .git/refs/top
+'
+
test_done