git-rebase.sh: Add check if rebase is in progress
"git rebase --continue" and friends gave nonsense errors when there is no rebase in progress. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stephan Beyer committed
Jun 22, 2008 at 16:07 UTC
cd5320f25228b4c3bbef2391df2696dca09d3d46
1 file changed
+10
-4
git-rebase.sh
+10
-4
@@ -150,6 +150,9 @@ while test $# != 0
150
do
151
case "$1" in
152
--continue)
153
+ test -d "$dotest" -o -d .dotest ||
154
+ die "No rebase in progress?"
155
+
156
git diff-files --quiet --ignore-submodules || {
157
echo "You must edit all merge conflicts and then"
158
echo "mark them as resolved using git add"
@@ -178,6 +181,9 @@ do
181
exit
182
;;
183
--skip)
184
+ test -d "$dotest" -o -d .dotest ||
185
+ die "No rebase in progress?"
186
+
187
git reset --hard HEAD || exit $?
188
if test -d "$dotest"
189
then
@@ -203,16 +209,16 @@ do
209
exit
210
;;
211
--abort)
212
+ test -d "$dotest" -o -d .dotest ||
213
+ die "No rebase in progress?"
214
+
215
git rerere clear
216
if test -d "$dotest"
217
then
218
move_to_original_branch
210
- elif test -d .dotest
211
- then
219
+ else
220
dotest=.dotest
221
move_to_original_branch
214
- else
215
- die "No rebase in progress?"
222
fi
223
git reset --hard $(cat "$dotest/orig-head")
224
rm -r "$dotest"