Skip to content

Commit 88e7dff

Browse files
committed
Merge branch 'jk/prune-top-level-refs-after-packing'
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"
2 parents bedd3b4 + afd11d3 commit 88e7dff

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,7 @@ static void prune_ref(struct ref_to_prune *r)
23892389
struct ref_transaction *transaction;
23902390
struct strbuf err = STRBUF_INIT;
23912391

2392-
if (check_refname_format(r->name + 5, 0))
2392+
if (check_refname_format(r->name, 0))
23932393
return;
23942394

23952395
transaction = ref_transaction_begin(&err);

t/t3210-pack-refs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,11 @@ test_expect_success 'delete ref while another dangling packed ref' '
151151
test_cmp /dev/null result
152152
'
153153

154+
test_expect_success 'pack ref directly below refs/' '
155+
git update-ref refs/top HEAD &&
156+
git pack-refs --all --prune &&
157+
grep refs/top .git/packed-refs &&
158+
test_path_is_missing .git/refs/top
159+
'
160+
154161
test_done

0 commit comments

Comments
 (0)