@@ -88,45 +88,63 @@ error_on_no_merge_candidates () {
88
88
esac
89
89
done
90
90
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
+
91
100
curr_branch=${curr_branch# refs/ heads/ }
92
101
upstream=$( git config " branch.$curr_branch .merge" )
93
102
remote=$( git config " branch.$curr_branch .remote" )
94
103
95
104
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."
97
111
echo " Generally this means that you provided a wildcard refspec which had no"
98
112
echo " matches on the remote end."
99
113
elif [ $# -gt 0 ] && [ " $1 " != " $remote " ]; then
100
114
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"
102
116
echo " for your current branch, you must specify a branch on the command line."
103
117
elif [ -z " $curr_branch " ]; then
104
118
echo " You are not currently on a branch, so I cannot use any"
105
119
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"
107
121
echo " line and try again (e.g. 'git pull <repository> <refspec>')."
108
122
echo " See git-pull(1) for details."
109
123
elif [ -z " $upstream " ]; then
110
124
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"
114
128
echo " try again (e.g. 'git pull <repository> <refspec>')."
115
129
echo " See git-pull(1) for details."
116
130
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"
120
139
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>"
125
143
echo
126
144
echo " See git-config(1) for details."
127
145
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."
130
148
fi
131
149
exit 1
132
150
}
0 commit comments