summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--refs.c2
-rwxr-xr-xt/t3210-pack-refs.sh7
2 files changed, 8 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 808e261c23..2ce5d69090 100644
--- 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);
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 1a2080e3dc..3a017bf437 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