@@ -90,23 +90,31 @@ error_on_no_merge_candidates () {
9090
9191 curr_branch=${curr_branch# refs/ heads/ }
9292
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
110118 exit 1
111119}
112120
0 commit comments