aboutsummaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-05-31 17:51:32 -0500
committerJunio C Hamano <gitster@pobox.com>2010-05-31 17:53:23 -0700
commitbffd750adf98c4a377571af73cf9a589f86495fb (patch)
treea8e22d08bfebb382b058b037f47699f1a7c57997 /git-rebase.sh
parent81fa024cd8e336ba257f13fe7724b95baacfa3ad (diff)
downloadgit-bffd750adf98c4a377571af73cf9a589f86495fb.tar.gz
git-bffd750adf98c4a377571af73cf9a589f86495fb.tar.xz
rebase: improve error message when upstream argument is missing
Strip out options before checking for a missing upstream argument. Before: $ git rebase -m shift: 426: can't shift that many After: $ git rebase -m Usage: git rebase ... While at it, fix the usage message to explain that the upstream argument is mandatory. Reported-by: Jon Dowland <jmtd@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 44f5c65fd..ab4afa7de 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2005 Junio C Hamano.
#
-USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'
+USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--no-ff] [--onto <newbase>] (<upstream>|--root) [<branch>] [--quiet | -q]'
LONG_USAGE='git-rebase replaces <branch> with a new branch of the
same name. When the --onto option is provided the new branch starts
out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -198,14 +198,6 @@ test -f "$GIT_DIR"/rebase-apply/applying &&
is_interactive "$@" && exec git-rebase--interactive "$@"
-if test $# -eq 0
-then
- test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply || usage
- test -d "$dotest" -o -f "$GIT_DIR"/rebase-apply/rebasing &&
- die 'A rebase is in progress, try --continue, --skip or --abort.'
- die "No arguments given and $GIT_DIR/rebase-apply already exists."
-fi
-
while test $# != 0
do
case "$1" in
@@ -370,6 +362,13 @@ do
done
test $# -gt 2 && usage
+if test $# -eq 0 && test -z "$rebase_root"
+then
+ test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply || usage
+ test -d "$dotest" -o -f "$GIT_DIR"/rebase-apply/rebasing &&
+ die 'A rebase is in progress, try --continue, --skip or --abort.'
+fi
+
# Make sure we do not have $GIT_DIR/rebase-apply
if test -z "$do_merge"
then