error_on_no_merge_candidates() does not consider the case where "$#"
includes command-line flags that are passed to git-fetch.
As such, when the current branch has no configured upstream, and there
are no merge candidates because of that, git-pull --all erroneously reports
that we are pulling from "--all", as it believes that the first argument
is the remote name.
Add a failing test that shows this case.
Reported-by: Stephen Robin <redacted>
Signed-off-by: Paul Tan <redacted>
---
Notes:
* Added this test to the patch series.
t/t5520-pull.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index d97a575..b93b735 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -153,6 +153,18 @@ test_expect_success 'fail if no configuration for current branch' '
test `cat file` = file
'
+test_expect_failure 'pull --all: fail if no configuration for current branch' '
+ git remote add test_remote . &&
+ test_when_finished "git remote remove test_remote" &&
+ git checkout -b test copy^ &&
+ test_when_finished "git checkout -f copy && git branch -D test" &&
+ test_config branch.test.remote test_remote &&
+ test `cat file` = file &&
+ test_must_fail git pull --all 2>out &&
+ test_i18ngrep "There is no tracking information" out &&
+ test `cat file` = file
+'
+
test_expect_success 'fail if upstream branch does not exist' '
git checkout -b test copy^ &&
test_when_finished "git checkout -f copy && git branch -D test" &&
--
2.1.4