Skip to content

Commit

Permalink
Merge branch 'bc/maint-fetch-url-only'
Browse files Browse the repository at this point in the history
* bc/maint-fetch-url-only:
  builtin/fetch.c: ignore merge config when not fetching from branch's remote
  t/t5510: demonstrate failure to fetch when current branch has merge ref
  • Loading branch information
Junio C Hamano committed Sep 8, 2010
2 parents 6b948a7 + 3ee1757 commit e250c59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ static struct ref *get_ref_map(struct transport *transport,
struct remote *remote = transport->remote;
struct branch *branch = branch_get(NULL);
int has_merge = branch_has_merge_config(branch);
if (remote && (remote->fetch_refspec_nr || has_merge)) {
if (remote &&
(remote->fetch_refspec_nr ||
(has_merge && !strcmp(branch->remote_name, remote->name)))) {
for (i = 0; i < remote->fetch_refspec_nr; i++) {
get_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);
if (remote->fetch[i].dst &&
Expand Down
6 changes: 6 additions & 0 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ test_expect_success 'fetch with a non-applying branch.<name>.merge' '
git fetch blub
'

test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge' '
git update-ref -d FETCH_HEAD &&
git fetch one &&
git rev-parse --verify FETCH_HEAD
'

# the strange name is: a\!'b
test_expect_success 'quoting of a strangely named repo' '
test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&
Expand Down

0 comments on commit e250c59

Please sign in to comment.