aboutsummaryrefslogtreecommitdiff
path: root/t/t5521-pull-options.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-02-24 11:02:05 -0800
committerJunio C Hamano <gitster@pobox.com>2010-02-24 11:16:36 -0800
commite6cc51046f3669332f51a52a7de966d842b9d4e4 (patch)
treecfeb5cb99a2312d95d219874ac68080f9089f67c /t/t5521-pull-options.sh
parentbba5322a71a3399a94f53e1dddf5bd66e493dfbc (diff)
downloadgit-e6cc51046f3669332f51a52a7de966d842b9d4e4.tar.gz
git-e6cc51046f3669332f51a52a7de966d842b9d4e4.tar.xz
fetch --all/--multiple: keep all the fetched branch information
Since "git fetch" learned "--all" and "--multiple" options, it has become tempting for users to say "git pull --all". Even though it may fetch from remotes that do not need to be fetched from for merging with the current branch, it is handy. "git fetch" however clears the list of fetched branches every time it contacts a different remote. Unless the current branch is configured to merge with a branch from a remote that happens to be the last in the list of remotes that are contacted, "git pull" that fetches from multiple remotes will not be able to find the branch it should be merging with. Make "fetch" clear FETCH_HEAD (unless --append is given) and then append the list of branches fetched to it (even when --append is not given). That way, "pull" will be able to find the data for the branch being merged in FETCH_HEAD no matter where the remote appears in the list of remotes to be contacted by "git fetch". Reported-by: Michael Lukashov Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5521-pull-options.sh')
-rwxr-xr-xt/t5521-pull-options.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 84059d82d..1b06691bb 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -72,4 +72,22 @@ test_expect_success 'git pull --force' '
)
'
+test_expect_success 'git pull --all' '
+ mkdir clonedmulti &&
+ (cd clonedmulti && git init &&
+ cat >>.git/config <<-\EOF &&
+ [remote "one"]
+ url = ../parent
+ fetch = refs/heads/*:refs/remotes/one/*
+ [remote "two"]
+ url = ../parent
+ fetch = refs/heads/*:refs/remotes/two/*
+ [branch "master"]
+ remote = one
+ merge = refs/heads/master
+ EOF
+ git pull --all
+ )
+'
+
test_done