@@ -88,45 +88,63 @@ error_on_no_merge_candidates () {
8888 esac
8989 done
9090
91+ if test true = " $rebase "
92+ then
93+ op_type=rebase
94+ op_prep=against
95+ else
96+ op_type=merge
97+ op_prep=with
98+ fi
99+
91100 curr_branch=${curr_branch# refs/ heads/ }
92101 upstream=$( git config " branch.$curr_branch .merge" )
93102 remote=$( git config " branch.$curr_branch .remote" )
94103
95104 if [ $# -gt 1 ]; then
96- echo " There are no candidates for merging in the refs that you just fetched."
105+ if [ " $rebase " = true ]; then
106+ printf " There is no candidate for rebasing against "
107+ else
108+ printf " There are no candidates for merging "
109+ fi
110+ echo " among the refs that you just fetched."
97111 echo " Generally this means that you provided a wildcard refspec which had no"
98112 echo " matches on the remote end."
99113 elif [ $# -gt 0 ] && [ " $1 " != " $remote " ]; then
100114 echo " You asked to pull from the remote '$1 ', but did not specify"
101- echo " a branch to merge . Because this is not the default configured remote"
115+ echo " a branch. Because this is not the default configured remote"
102116 echo " for your current branch, you must specify a branch on the command line."
103117 elif [ -z " $curr_branch " ]; then
104118 echo " You are not currently on a branch, so I cannot use any"
105119 echo " 'branch.<branchname>.merge' in your configuration file."
106- echo " Please specify which branch you want to merge on the command"
120+ echo " Please specify which remote branch you want to use on the command"
107121 echo " line and try again (e.g. 'git pull <repository> <refspec>')."
108122 echo " See git-pull(1) for details."
109123 elif [ -z " $upstream " ]; then
110124 echo " You asked me to pull without telling me which branch you"
111- echo " want to merge with , and 'branch.${curr_branch} .merge' in"
112- echo " your configuration file does not tell me either. Please"
113- echo " specify which branch you want to merge on the command line and"
125+ echo " want to $op_type $op_prep , and 'branch.${curr_branch} .merge' in"
126+ echo " your configuration file does not tell me, either. Please"
127+ echo " specify which branch you want to use on the command line and"
114128 echo " try again (e.g. 'git pull <repository> <refspec>')."
115129 echo " See git-pull(1) for details."
116130 echo
117- echo " If you often merge with the same branch, you may want to"
118- echo " configure the following variables in your configuration"
119- echo " file:"
131+ echo " If you often $op_type $op_prep the same branch, you may want to"
132+ echo " use something like the following in your configuration file:"
133+ echo
134+ echo " [branch \" ${curr_branch} \" ]"
135+ echo " remote = <nickname>"
136+ echo " merge = <remote-ref>"
137+ test rebase = " $op_type " &&
138+ echo " rebase = true"
120139 echo
121- echo " branch.${curr_branch} .remote = <nickname>"
122- echo " branch.${curr_branch} .merge = <remote-ref>"
123- echo " remote.<nickname>.url = <url>"
124- echo " remote.<nickname>.fetch = <refspec>"
140+ echo " [remote \" <nickname>\" ]"
141+ echo " url = <url>"
142+ echo " fetch = <refspec>"
125143 echo
126144 echo " See git-config(1) for details."
127145 else
128- echo " Your configuration specifies to merge the ref '${upstream# refs/ heads/ } ' from the "
129- echo " remote, but no such ref was fetched."
146+ echo " Your configuration specifies to $op_type $op_prep the ref '${upstream# refs/ heads/ } '"
147+ echo " from the remote, but no such ref was fetched."
130148 fi
131149 exit 1
132150}
0 commit comments