diff options
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-x | git-rebase.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/git-rebase.sh b/git-rebase.sh index 6bd8eae648..1cd0633b80 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -32,7 +32,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>] -git rebase [-i] [options] [--exec <cmd>] --onto <newbase> --root [<branch>] +git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>] git-rebase [-i] --continue | --abort | --skip -- Available options are @@ -378,6 +378,11 @@ and run me again. I am stopping in case you still have something valuable there.' fi +if test -n "$rebase_root" && test -z "$onto" +then + test -z "$interactive_rebase" && interactive_rebase=implied +fi + if test -n "$interactive_rebase" then type=interactive @@ -411,9 +416,15 @@ then die "invalid upstream $upstream_name" upstream_arg="$upstream_name" else - test -z "$onto" && die "You must specify --onto when using --root" + if test -z "$onto" + then + empty_tree=`git hash-object -t tree /dev/null` + onto=`git commit-tree $empty_tree </dev/null` + squash_onto="$onto" + fi unset upstream_name unset upstream + test $# -gt 1 && usage upstream_arg=--root fi @@ -464,7 +475,7 @@ case "$#" in die "fatal: no such branch: $1" fi ;; -*) +0) # Do not need to switch branches, we are already on it. if branch_name=`git symbolic-ref -q HEAD` then @@ -476,6 +487,9 @@ case "$#" in fi orig_head=$(git rev-parse --verify "${branch_name}^0") || exit ;; +*) + die "BUG: unexpected number of arguments left to parse" + ;; esac require_clean_work_tree "rebase" "Please commit or stash them." |