Skip to content

Commit f583ace

Browse files
committed
Merge branch 'jk/allow-fetch-onelevel-refname'
"git clone" would fail to clone from a repository that has a ref directly under "refs/", e.g. "refs/stash", because different validation paths do different things on such a refname. Loosen the client side's validation to allow such a ref. * jk/allow-fetch-onelevel-refname: fetch-pack: do not filter out one-level refs
2 parents 6376327 + 4c22408 commit f583ace

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static void filter_refs(struct fetch_pack_args *args,
506506
next = ref->next;
507507

508508
if (!memcmp(ref->name, "refs/", 5) &&
509-
check_refname_format(ref->name + 5, 0))
509+
check_refname_format(ref->name, 0))
510510
; /* trash */
511511
else {
512512
while (i < nr_sought) {

t/t5510-fetch.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,4 +640,15 @@ test_expect_success 'branchname D/F conflict resolved by --prune' '
640640
test_cmp expect actual
641641
'
642642

643+
test_expect_success 'fetching a one-level ref works' '
644+
test_commit extra &&
645+
git reset --hard HEAD^ &&
646+
git update-ref refs/foo extra &&
647+
git init one-level &&
648+
(
649+
cd one-level &&
650+
git fetch .. HEAD refs/foo
651+
)
652+
'
653+
643654
test_done

0 commit comments

Comments
 (0)