@@ -91,45 +91,63 @@ error_on_no_merge_candidates () {
9191 esac
9292 done
9393
94+ if test true = " $rebase "
95+ then
96+ op_type=rebase
97+ op_prep=against
98+ else
99+ op_type=merge
100+ op_prep=with
101+ fi
102+
94103 curr_branch=${curr_branch# refs/ heads/ }
95104 upstream=$( git config " branch.$curr_branch .merge" )
96105 remote=$( git config " branch.$curr_branch .remote" )
97106
98107 if [ $# -gt 1 ]; then
99- echo " There are no candidates for merging in the refs that you just fetched."
108+ if [ " $rebase " = true ]; then
109+ printf " There is no candidate for rebasing against "
110+ else
111+ printf " There are no candidates for merging "
112+ fi
113+ echo " among the refs that you just fetched."
100114 echo " Generally this means that you provided a wildcard refspec which had no"
101115 echo " matches on the remote end."
102116 elif [ $# -gt 0 ] && [ " $1 " != " $remote " ]; then
103117 echo " You asked to pull from the remote '$1 ', but did not specify"
104- echo " a branch to merge . Because this is not the default configured remote"
118+ echo " a branch. Because this is not the default configured remote"
105119 echo " for your current branch, you must specify a branch on the command line."
106120 elif [ -z " $curr_branch " ]; then
107121 echo " You are not currently on a branch, so I cannot use any"
108122 echo " 'branch.<branchname>.merge' in your configuration file."
109- echo " Please specify which branch you want to merge on the command"
123+ echo " Please specify which remote branch you want to use on the command"
110124 echo " line and try again (e.g. 'git pull <repository> <refspec>')."
111125 echo " See git-pull(1) for details."
112126 elif [ -z " $upstream " ]; then
113127 echo " You asked me to pull without telling me which branch you"
114- echo " want to merge with , and 'branch.${curr_branch} .merge' in"
115- echo " your configuration file does not tell me either. Please"
116- echo " specify which branch you want to merge on the command line and"
128+ echo " want to $op_type $op_prep , and 'branch.${curr_branch} .merge' in"
129+ echo " your configuration file does not tell me, either. Please"
130+ echo " specify which branch you want to use on the command line and"
117131 echo " try again (e.g. 'git pull <repository> <refspec>')."
118132 echo " See git-pull(1) for details."
119133 echo
120- echo " If you often merge with the same branch, you may want to"
121- echo " configure the following variables in your configuration"
122- echo " file:"
134+ echo " If you often $op_type $op_prep the same branch, you may want to"
135+ echo " use something like the following in your configuration file:"
136+ echo
137+ echo " [branch \" ${curr_branch} \" ]"
138+ echo " remote = <nickname>"
139+ echo " merge = <remote-ref>"
140+ test rebase = " $op_type " &&
141+ echo " rebase = true"
123142 echo
124- echo " branch.${curr_branch} .remote = <nickname>"
125- echo " branch.${curr_branch} .merge = <remote-ref>"
126- echo " remote.<nickname>.url = <url>"
127- echo " remote.<nickname>.fetch = <refspec>"
143+ echo " [remote \" <nickname>\" ]"
144+ echo " url = <url>"
145+ echo " fetch = <refspec>"
128146 echo
129147 echo " See git-config(1) for details."
130148 else
131- echo " Your configuration specifies to merge the ref '${upstream# refs/ heads/ } ' from the "
132- echo " remote, but no such ref was fetched."
149+ echo " Your configuration specifies to $op_type $op_prep the ref '${upstream# refs/ heads/ } '"
150+ echo " from the remote, but no such ref was fetched."
133151 fi
134152 exit 1
135153}
0 commit comments