summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fetch-pack.c2
-rwxr-xr-xt/t5510-fetch.sh11
2 files changed, 12 insertions, 1 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 1042448fa0..fab5e80175 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -507,7 +507,7 @@ static void filter_refs(struct fetch_pack_args *args,
next = ref->next;
if (!memcmp(ref->name, "refs/", 5) &&
- check_refname_format(ref->name + 5, 0))
+ check_refname_format(ref->name, 0))
; /* trash */
else {
while (i < nr_sought) {
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 1f0f8e6827..07986d94bd 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -594,4 +594,15 @@ test_expect_success 'all boundary commits are excluded' '
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
'
+test_expect_success 'fetching a one-level ref works' '
+ test_commit extra &&
+ git reset --hard HEAD^ &&
+ git update-ref refs/foo extra &&
+ git init one-level &&
+ (
+ cd one-level &&
+ git fetch .. HEAD refs/foo
+ )
+'
+
test_done