summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-13 12:31:13 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-13 12:31:13 -0800
commit1f73566af5bec28cd8489c6139a9ede95817349c (patch)
treeb1deca9888bc171d09420d927bbe694795cf5d83 /git-rebase--interactive.sh
parent5b9c0a699bdf9727d25eceb7b980dbede96bfd8e (diff)
parent230a4566382860fc26a3f8d578a41c6504cf865f (diff)
downloadgit-1f73566af5bec28cd8489c6139a9ede95817349c.tar.gz
Merge branch 'jc/checkout-merge-base'
* jc/checkout-merge-base: rebase -i: teach --onto A...B syntax rebase: fix --onto A...B parsing and add tests "rebase --onto A...B" replays history on the merge base between A and B "checkout A...B" switches to the merge base between A and B
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6ed57e2664..1560e84bd5 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -495,6 +495,25 @@ get_saved_options () {
test -f "$DOTEST"/rebase-root && REBASE_ROOT=t
}
+LF='
+'
+parse_onto () {
+ case "$1" in
+ *...*)
+ if left=${1%...*} right=${1#*...} &&
+ onto=$(git merge-base --all ${left:-HEAD} ${right:-HEAD})
+ then
+ case "$onto" in
+ ?*"$LF"?* | '')
+ exit 1 ;;
+ esac
+ echo "$onto"
+ exit 0
+ fi
+ esac
+ git rev-parse --verify "$1^0"
+}
+
while test $# != 0
do
case "$1" in
@@ -602,7 +621,7 @@ first and then run 'git rebase --continue' again."
;;
--onto)
shift
- ONTO=$(git rev-parse --verify "$1") ||
+ ONTO=$(parse_onto "$1") ||
die "Does not point to a valid commit: $1"
;;
--)