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 33# Copyright (c) 2005 Junio C Hamano.
44#
55
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]'
77LONG_USAGE=' git-rebase replaces <branch> with a new branch of the
88same name. When the --onto option is provided the new branch starts
99out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -198,14 +198,6 @@ test -f "$GIT_DIR"/rebase-apply/applying &&
198198
199199is_interactive " $@ " && exec git-rebase--interactive " $@ "
200200
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-
209201while test $# ! = 0
210202do
211203 case " $1 " in
370362done
371363test $# -gt 2 && usage
372364
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+
373372# Make sure we do not have $GIT_DIR/rebase-apply
374373if test -z " $do_merge "
375374then
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' '
126126 test_must_fail git rebase topic 2> output.err > output.out &&
127127 grep "Untracked working tree file .B. would be overwritten" output.err
128128'
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+ '
129141
130142test_expect_success ' rebase -q is quiet' '
131- rm B &&
132143 git checkout -b quiet topic &&
133144 git rebase -q master > output.out 2>&1 &&
134145 test ! -s output.out
You can’t perform that action at this time.
0 commit comments