{"thread":{"id":"22887","subject":"[PATCH] pull --all: fix error message when current branch is not tracking remote branch","startedAt":"2010-03-02T21:52:21Z","lastAt":"2010-03-08T20:26:32Z","messageCount":2,"participants":["Michael Lukashov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"136043","messageId":"1267566741-5784-1-git-send-email-michael.lukashov@gmail.com","threadId":"22887","inReplyTo":null,"subject":"[PATCH] pull --all: fix error message when current branch is not tracking remote branch","fromName":"Michael Lukashov","fromEmail":"michael.lukashov@gmail.com","sentAt":"2010-03-02T21:52:21Z","receivedAt":"2010-03-02T21:52:21Z","isPatch":true,"sender":{"key":"michael.lukashov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/890439?v=4"},"body":"If current branch doesn't track remote branch, \"git pull --all\" produces\na confusing message:\n\n  You asked to pull from the remote '--all', but did not specify\n  a branch. Because this is not the default configured remote\n  for your current branch, you must specify a branch on the command line.\n\nTo fix this, simply move up check if current branch is configured to track\nremote branch.\n\nThis patch applies on top of branch 'next' of git.git repository.\n\nSigned-off-by: Michael Lukashov <michael.lukashov@gmail.com>\n---\n git-pull.sh             |   20 ++++++++++----------\n t/t5521-pull-options.sh |    5 +++++\n 2 files changed, 15 insertions(+), 10 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 38331a8..df16ea0 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -147,16 +147,6 @@ error_on_no_merge_candidates () {\n \t\techo \"among the refs that you just fetched.\"\n \t\techo \"Generally this means that you provided a wildcard refspec which had no\"\n \t\techo \"matches on the remote end.\"\n-\telif [ $# -gt 0 ] && [ \"$1\" != \"$remote\" ]; then\n-\t\techo \"You asked to pull from the remote '$1', but did not specify\"\n-\t\techo \"a branch. Because this is not the default configured remote\"\n-\t\techo \"for your current branch, you must specify a branch on the command line.\"\n-\telif [ -z \"$curr_branch\" ]; then\n-\t\techo \"You are not currently on a branch, so I cannot use any\"\n-\t\techo \"'branch.<branchname>.merge' in your configuration file.\"\n-\t\techo \"Please specify which remote branch you want to use on the command\"\n-\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n-\t\techo \"See git-pull(1) for details.\"\n \telif [ -z \"$upstream\" ]; then\n \t\techo \"You asked me to pull without telling me which branch you\"\n \t\techo \"want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in\"\n@@ -179,6 +169,16 @@ error_on_no_merge_candidates () {\n \t\techo \"    fetch = <refspec>\"\n \t\techo\n \t\techo \"See git-config(1) for details.\"\n+\telif [ $# -gt 0 ] && [ \"$1\" != \"$remote\" ]; then\n+\t\techo \"You asked to pull from the remote '$1', but did not specify\"\n+\t\techo \"a branch. Because this is not the default configured remote\"\n+\t\techo \"for your current branch, you must specify a branch on the command line.\"\n+\telif [ -z \"$curr_branch\" ]; then\n+\t\techo \"You are not currently on a branch, so I cannot use any\"\n+\t\techo \"'branch.<branchname>.merge' in your configuration file.\"\n+\t\techo \"Please specify which remote branch you want to use on the command\"\n+\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details.\"\n \telse\n \t\techo \"Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'\"\n \t\techo \"from the remote, but no such ref was fetched.\"\ndiff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh\nindex 1b06691..64ba39f 100755\n--- a/t/t5521-pull-options.sh\n+++ b/t/t5521-pull-options.sh\n@@ -87,6 +87,11 @@ test_expect_success 'git pull --all' '\n \t\tmerge = refs/heads/master\n \tEOF\n \tgit pull --all\n+\t) &&\n+\t(cd clonedmulti &&\n+\tgit checkout -b side &&\n+\ttest_must_fail git pull --all 2>err &&\n+\tgrep \"You asked me to pull without telling me which branch\" err\n \t)\n '\n \n-- \n1.7.0.1.1704.g1a7f8\n"},{"id":"136409","messageId":"63cde7731003081226hb27c705l9038f2dccfd1c042@mail.gmail.com","threadId":"22887","inReplyTo":"1267566741-5784-1-git-send-email-michael.lukashov@gmail.com","subject":"Re: [PATCH] pull --all: fix error message when current branch is not tracking remote branch","fromName":"Michael Lukashov","fromEmail":"michael.lukashov@gmail.com","sentAt":"2010-03-08T20:26:32Z","receivedAt":"2010-03-08T20:26:32Z","isPatch":true,"sender":{"key":"michael.lukashov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/890439?v=4"},"body":"No-one ever interested?\nThought it's useful improvement.\n\nInstead of above-mentioned confusing message, you get\nmuch more clearer explanation:\n\nYou asked me to pull without telling me which branch you\nwant to merge with, and 'branch.<>.merge' in\nyour configuration file does not tell me, either. Please\nspecify which branch you want to use on the command line and\ntry again (e.g. 'git pull <repository> <refspec>').\nSee git-pull(1) for details.\n\n...\n"}]}