pull: Clarify "helpful" message for another corner case
When the remote branch we asked for merging did not exist in the set of fetched refs, we unconditionally hinted that it was because of lack of configuration. It is not necessarily so, and risks sending users for a wild goose chase. Make sure to check if that is indeed the case before telling a wild guess to the user. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 13, 2009 at 13:38 UTC
a6dbf8814f433a7fbfa9cde6333c98019f6db1e4
1 file changed
+6
-1
git-pull.sh
+6
-1
@@ -89,6 +89,7 @@ error_on_no_merge_candidates () {
89
done
90
91
curr_branch=${curr_branch#refs/heads/}
92
+ upstream=$(git config "branch.$curr_branch.merge")
93
94
if [ -z "$curr_branch" ]; then
95
echo "You are not currently on a branch, so I cannot use any"
@@ -96,7 +97,7 @@ error_on_no_merge_candidates () {
97
echo "Please specify which branch you want to merge on the command"
98
echo "line and try again (e.g. 'git pull <repository> <refspec>')."
99
echo "See git-pull(1) for details."
99
- else
100
+ elif [ -z "$upstream" ]; then
101
echo "You asked me to pull without telling me which branch you"
102
echo "want to merge with, and 'branch.${curr_branch}.merge' in"
103
echo "your configuration file does not tell me either. Please"
@@ -114,6 +115,10 @@ error_on_no_merge_candidates () {
115
echo " remote.<nickname>.fetch = <refspec>"
116
echo
117
echo "See git-config(1) for details."
118
+ else
119
+ echo "Your configuration specifies to merge the ref"
120
+ echo "'${upstream#refs/heads/}' from the remote, but no such ref"
121
+ echo "was fetched."
122
fi
123
exit 1
124
}