aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-09-08 09:17:00 -0700
committerJunio C Hamano <gitster@pobox.com>2010-09-08 09:17:00 -0700
commite250c5914fd151caf228cbda6c30560c266bcfef (patch)
tree8420c1badd4b4599d859f7f6ddab8fff5cf8bf14
parent6b948a7a480b4ad5e112eb1642e9160e2a3b4f2b (diff)
parent3ee1757baeecb6fe6c8b2446b3afe0519584b63f (diff)
downloadgit-e250c5914fd151caf228cbda6c30560c266bcfef.tar.gz
git-e250c5914fd151caf228cbda6c30560c266bcfef.tar.xz
Merge branch 'bc/maint-fetch-url-only'
* 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
-rw-r--r--builtin/fetch.c4
-rwxr-xr-xt/t5510-fetch.sh6
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index fab3fce51..fccc9cbea 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -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 &&
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 4eb10f602..8fbd894e7 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -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 &&