Skip to content

Commit

Permalink
Merge branch 'jk/prune-top-level-refs-after-packing'
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
Junio C Hamano committed Sep 11, 2014
2 parents bedd3b4 + afd11d3 commit 88e7dff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions t/t3210-pack-refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 88e7dff

Please sign in to comment.