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