]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/prune-top-level-refs-after-packing'
authorJunio C Hamano <gitster@pobox.com>
Thu, 11 Sep 2014 17:33:33 +0000 (10:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Sep 2014 17:33:33 +0000 (10:33 -0700)
After "pack-refs --prune" packed refs at the top-level, it failed
to prune them.

* jk/prune-top-level-refs-after-packing:
  pack-refs: prune top-level refs like "refs/foo"

refs.c
t/t3210-pack-refs.sh

diff --git a/refs.c b/refs.c
index 808e261c235b9803a80faefd79a6329cebcf5fc1..2ce5d690907d33bda557f66150ef1317f39b4f93 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -2389,7 +2389,7 @@ static void prune_ref(struct ref_to_prune *r)
        struct ref_transaction *transaction;
        struct strbuf err = STRBUF_INIT;
 
-       if (check_refname_format(r->name + 5, 0))
+       if (check_refname_format(r->name, 0))
                return;
 
        transaction = ref_transaction_begin(&err);
index 1a2080e3dca272b6ed40739a7539f01f4f6ae65c..3a017bf437395526cf54403d4ea1db36a3cff0b3 100755 (executable)
@@ -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