rebase: use peel_committish() where appropriate
The revisions specified on the command-line as <onto> and <upstream> arguments could be of the form :/quuxery; so, use peel_committish() to resolve them. The failing tests in t/rebase and t/rebase-interactive now pass. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Jun 14, 2013 at 18:47 UTC
2e6e276decde2a9f04fc29bce734a49d3ba8f484
3 files changed
+4
-4
git-rebase.sh
+2
-2
@@ -434,7 +434,7 @@ then
434
shift
435
;;
436
esac
437
- upstream=`git rev-parse --verify "${upstream_name}^0"` ||
437
+ upstream=$(peel_committish "${upstream_name}") ||
438
die "$(eval_gettext "invalid upstream \$upstream_name")"
439
upstream_arg="$upstream_name"
440
else
@@ -470,7 +470,7 @@ case "$onto_name" in
470
fi
471
;;
472
*)
473
- onto=$(git rev-parse --verify "${onto_name}^0") ||
473
+ onto=$(peel_committish "$onto_name") ||
474
die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"
475
;;
476
esac
t/t3400-rebase.sh
+1
-1
@@ -88,7 +88,7 @@ test_expect_success 'rebase fast-forward to master' '
88
test_i18ngrep "Fast-forwarded HEAD to my-topic-branch" out
89
'
90
91
-test_expect_failure 'rebase, with <onto> and <upstream> specified as :/quuxery' '
91
+test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
92
test_when_finished "git branch -D torebase" &&
93
git checkout -b torebase my-topic-branch^ &&
94
upstream=$(git rev-parse ":/Add B") &&
t/t3404-rebase-interactive.sh
+1
-1
@@ -947,7 +947,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
947
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
948
'
949
950
-test_expect_failure 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
950
+test_expect_success 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
951
test_when_finished "git branch -D torebase" &&
952
git checkout -b torebase branch1 &&
953
upstream=$(git rev-parse ":/J") &&