File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 3
3
# Copyright (c) 2005 Junio C Hamano.
4
4
#
5
5
6
- USAGE=' [--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [ <upstream>|--root] [<branch>] [--quiet | -q]'
6
+ USAGE=' [--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] ( <upstream>|--root) [<branch>] [--quiet | -q]'
7
7
LONG_USAGE=' git-rebase replaces <branch> with a new branch of the
8
8
same name. When the --onto option is provided the new branch starts
9
9
out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -198,14 +198,6 @@ test -f "$GIT_DIR"/rebase-apply/applying &&
198
198
199
199
is_interactive " $@ " && exec git-rebase--interactive " $@ "
200
200
201
- if test $# -eq 0
202
- then
203
- test -d " $dotest " -o -d " $GIT_DIR " /rebase-apply || usage
204
- test -d " $dotest " -o -f " $GIT_DIR " /rebase-apply/rebasing &&
205
- die ' A rebase is in progress, try --continue, --skip or --abort.'
206
- die " No arguments given and $GIT_DIR /rebase-apply already exists."
207
- fi
208
-
209
201
while test $# ! = 0
210
202
do
211
203
case " $1 " in
370
362
done
371
363
test $# -gt 2 && usage
372
364
365
+ if test $# -eq 0 && test -z " $rebase_root "
366
+ then
367
+ test -d " $dotest " -o -d " $GIT_DIR " /rebase-apply || usage
368
+ test -d " $dotest " -o -f " $GIT_DIR " /rebase-apply/rebasing &&
369
+ die ' A rebase is in progress, try --continue, --skip or --abort.'
370
+ fi
371
+
373
372
# Make sure we do not have $GIT_DIR/rebase-apply
374
373
if test -z " $do_merge "
375
374
then
Original file line number Diff line number Diff line change @@ -126,9 +126,20 @@ test_expect_success 'Show verbose error when HEAD could not be detached' '
126
126
test_must_fail git rebase topic 2> output.err > output.out &&
127
127
grep "Untracked working tree file .B. would be overwritten" output.err
128
128
'
129
+ rm -f B
130
+
131
+ test_expect_success ' dump usage when upstream arg is missing' '
132
+ git checkout -b usage topic &&
133
+ test_must_fail git rebase 2>error1 &&
134
+ grep "[Uu]sage" error1 &&
135
+ test_must_fail git rebase --abort 2>error2 &&
136
+ grep "No rebase in progress" error2 &&
137
+ test_must_fail git rebase --onto master 2>error3 &&
138
+ grep "[Uu]sage" error3 &&
139
+ ! grep "can.t shift" error3
140
+ '
129
141
130
142
test_expect_success ' rebase -q is quiet' '
131
- rm B &&
132
143
git checkout -b quiet topic &&
133
144
git rebase -q master > output.out 2>&1 &&
134
145
test ! -s output.out
You can’t perform that action at this time.
0 commit comments