Skip to content

Commit

Permalink
Merge branch 'jk/allow-fetch-onelevel-refname'
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Jan 27, 2014
2 parents 6376327 + 4c22408 commit f583ace
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,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) {
Expand Down
11 changes: 11 additions & 0 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,15 @@ test_expect_success 'branchname D/F conflict resolved by --prune' '
test_cmp expect actual
'

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

0 comments on commit f583ace

Please sign in to comment.