git-pull.sh: better warning message for "git pull" on detached head.
Otherwise, git complains about not finding a branch to pull from in 'branch..merge', which is hardly understandable. While we're there, reword the sentences slightly. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthieu Moy committed
Apr 8, 2009 at 09:24 UTC
61e6108d94353d932d397e4be498c7e5293723eb
1 file changed
+25
-17
git-pull.sh
+25
-17
@@ -90,23 +90,31 @@ error_on_no_merge_candidates () {
90
91
curr_branch=${curr_branch#refs/heads/}
92
93
- echo "You asked me to pull without telling me which branch you"
94
- echo "want to merge with, and 'branch.${curr_branch}.merge' in"
95
- echo "your configuration file does not tell me either. Please"
96
- echo "name which branch you want to merge on the command line and"
97
- echo "try again (e.g. 'git pull <repository> <refspec>')."
98
- echo "See git-pull(1) for details on the refspec."
99
- echo
100
- echo "If you often merge with the same branch, you may want to"
101
- echo "configure the following variables in your configuration"
102
- echo "file:"
103
- echo
104
- echo " branch.${curr_branch}.remote = <nickname>"
105
- echo " branch.${curr_branch}.merge = <remote-ref>"
106
- echo " remote.<nickname>.url = <url>"
107
- echo " remote.<nickname>.fetch = <refspec>"
108
- echo
109
- echo "See git-config(1) for details."
93
+ if [ -z "$curr_branch" ]; then
94
+ echo "You are not currently on a branch, so I cannot use any"
95
+ echo "'branch.<branchname>.merge' in your configuration file."
96
+ echo "Please specify which branch you want to merge on the command"
97
+ echo "line and try again (e.g. 'git pull <repository> <refspec>')."
98
+ echo "See git-pull(1) for details."
99
+ else
100
+ echo "You asked me to pull without telling me which branch you"
101
+ echo "want to merge with, and 'branch.${curr_branch}.merge' in"
102
+ echo "your configuration file does not tell me either. Please"
103
+ echo "specify which branch you want to merge on the command line and"
104
+ echo "try again (e.g. 'git pull <repository> <refspec>')."
105
+ echo "See git-pull(1) for details."
106
+ echo
107
+ echo "If you often merge with the same branch, you may want to"
108
+ echo "configure the following variables in your configuration"
109
+ echo "file:"
110
+ echo
111
+ echo " branch.${curr_branch}.remote = <nickname>"
112
+ echo " branch.${curr_branch}.merge = <remote-ref>"
113
+ echo " remote.<nickname>.url = <url>"
114
+ echo " remote.<nickname>.fetch = <refspec>"
115
+ echo
116
+ echo "See git-config(1) for details."
117
+ fi
118
exit 1
119
}
120