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 <artag...@gmail.com>
---
 t/t3400-rebase.sh             | 11 +++++++++++
 t/t3404-rebase-interactive.sh | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index b58fa1a..81ec517 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -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 "<>")
 '
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 79e8d3c..eb241f5 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -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
-- 
1.8.3.1.381.g12ca056.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to