Skip to content

Commit 6567dc0

Browse files
artagnongitster
authored andcommitted
t/rebase: add failing tests for a peculiar revision
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bdff0e3 commit 6567dc0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

t/t3400-rebase.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ test_expect_success 'rebase fast-forward to master' '
8888
test_i18ngrep "Fast-forwarded HEAD to my-topic-branch" out
8989
'
9090

91+
test_expect_failure '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") &&
95+
onto=$(git rev-parse ":/Add A") &&
96+
git rebase --onto $onto $upstream &&
97+
git reset --hard my-topic-branch^ &&
98+
git rebase --onto ":/Add A" ":/Add B" &&
99+
git checkout my-topic-branch
100+
'
101+
91102
test_expect_success 'the rebase operation should not have destroyed author information' '
92103
! (git log | grep "Author:" | grep "<>")
93104
'

t/t3404-rebase-interactive.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,4 +947,15 @@ test_expect_success 'rebase -i respects core.commentchar' '
947947
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
948948
'
949949

950+
test_expect_failure '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") &&
954+
onto=$(git rev-parse ":/A") &&
955+
git rebase --onto $onto $upstream &&
956+
git reset --hard branch1 &&
957+
git rebase --onto ":/A" ":/J" &&
958+
git checkout branch1
959+
'
960+
950961
test_done

0 commit comments

Comments
 (0)