aboutsummaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-15 21:38:41 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-15 21:38:42 -0700
commit0cd993a778d7c14bed34f624fce46724242557ed (patch)
treecdd3284f5bd60e38751673953148793ccb1b79d1 /git-rebase.sh
parent77f3591dbbceebfd026d087709d91cd3a9b3e8a1 (diff)
parent994fd91d1fd5e9feffc88ab7db19e9c9461b4543 (diff)
downloadgit-0cd993a778d7c14bed34f624fce46724242557ed.tar.gz
git-0cd993a778d7c14bed34f624fce46724242557ed.tar.xz
Merge branch 'cw/rebase-i-root'
"git rebase [-i] --root $tip" can now be used to rewrite all the history down to the root. * cw/rebase-i-root: t3404: make test 57 work with dash and others Add tests for rebase -i --root without --onto rebase -i: support --root without --onto
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 5bddfa969..1cd0633b8 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,7 +416,12 @@ 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