]> granicus.if.org Git - git/commitdiff
t/rebase: add failing tests for a peculiar revision
authorRamkumar Ramachandra <artagnon@gmail.com>
Fri, 14 Jun 2013 13:17:50 +0000 (18:47 +0530)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2013 16:40:30 +0000 (09:40 -0700)
The following commands fail, even if :/quuxery and :/foomery resolve to
perfectly valid commits:

  $ git rebase [-i] --onto :/quuxery :/foomery

This is because rebase [-i] attempts to rev-parse ${REV}^0 to verify
that the given revision resolves to a commit.  Add tests to document
these failures.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3400-rebase.sh
t/t3404-rebase-interactive.sh

index b58fa1a23243e435f119afb9966b0a80cbc1e4d4..81ec5176294083135abd5d7e03f3a213ce7da497 100755 (executable)
@@ -88,6 +88,17 @@ test_expect_success 'rebase fast-forward to master' '
        test_i18ngrep "Fast-forwarded HEAD to my-topic-branch" out
 '
 
+test_expect_failure 'rebase, with <onto> and <upstream> specified as :/quuxery' '
+       test_when_finished "git branch -D torebase" &&
+       git checkout -b torebase my-topic-branch^ &&
+       upstream=$(git rev-parse ":/Add B") &&
+       onto=$(git rev-parse ":/Add A") &&
+       git rebase --onto $onto $upstream &&
+       git reset --hard my-topic-branch^ &&
+       git rebase --onto ":/Add A" ":/Add B" &&
+       git checkout my-topic-branch
+'
+
 test_expect_success 'the rebase operation should not have destroyed author information' '
        ! (git log | grep "Author:" | grep "<>")
 '
index 79e8d3c5966bad34b317c6e35c301ecfaa3ab648..eb241f531273819ef9e62f20fdbe4811996a3fc6 100755 (executable)
@@ -947,4 +947,15 @@ test_expect_success 'rebase -i respects core.commentchar' '
        test B = $(git cat-file commit HEAD^ | sed -ne \$p)
 '
 
+test_expect_failure 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
+       test_when_finished "git branch -D torebase" &&
+       git checkout -b torebase branch1 &&
+       upstream=$(git rev-parse ":/J") &&
+       onto=$(git rev-parse ":/A") &&
+       git rebase --onto $onto $upstream &&
+       git reset --hard branch1 &&
+       git rebase --onto ":/A" ":/J" &&
+       git checkout branch1
+'
+
 test_done