summaryrefslogtreecommitdiff
path: root/t/t3400-rebase.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t3400-rebase.sh')
-rwxr-xr-xt/t3400-rebase.sh56
1 files changed, 53 insertions, 3 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index ebf93b0695..47b5682662 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -88,6 +88,23 @@ test_expect_success 'rebase from ambiguous branch name' '
git rebase master
'
+test_expect_success 'rebase off of the previous branch using "-"' '
+ git checkout master &&
+ git checkout HEAD^ &&
+ git rebase @{-1} >expect.messages &&
+ git merge-base master HEAD >expect.forkpoint &&
+
+ git checkout master &&
+ git checkout HEAD^ &&
+ git rebase - >actual.messages &&
+ git merge-base master HEAD >actual.forkpoint &&
+
+ test_cmp expect.forkpoint actual.forkpoint &&
+ # the next one is dubious---we may want to say "-",
+ # instead of @{-1}, in the message
+ test_i18ncmp expect.messages actual.messages
+'
+
test_expect_success 'rebase a single mode change' '
git checkout master &&
git branch -D topic &&
@@ -134,12 +151,45 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
test_must_fail git rebase
'
-test_expect_success 'default to @{upstream} when upstream arg is missing' '
+test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg' '
+ git checkout -b default-base master &&
git checkout -b default topic &&
git config branch.default.remote . &&
- git config branch.default.merge refs/heads/master &&
+ git config branch.default.merge refs/heads/default-base &&
+ git rebase &&
+ git rev-parse --verify default-base >expect &&
+ git rev-parse default~1 >actual &&
+ test_cmp expect actual &&
+ git checkout default-base &&
+ git reset --hard HEAD^ &&
+ git checkout default &&
+ git rebase &&
+ git rev-parse --verify default-base >expect &&
+ git rev-parse default~1 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'cherry-picked commits and fork-point work together' '
+ git checkout default-base &&
+ echo Amended >A &&
+ git commit -a --no-edit --amend &&
+ test_commit B B &&
+ test_commit new_B B "New B" &&
+ test_commit C C &&
+ git checkout default &&
+ git reset --hard default-base@{4} &&
+ test_commit D D &&
+ git cherry-pick -2 default-base^ &&
+ test_commit final_B B "Final B" &&
git rebase &&
- test "$(git rev-parse default~1)" = "$(git rev-parse master)"
+ echo Amended >expect &&
+ test_cmp A expect &&
+ echo "Final B" >expect &&
+ test_cmp B expect &&
+ echo C >expect &&
+ test_cmp C expect &&
+ echo D >expect &&
+ test_cmp D expect
'
test_expect_success 'rebase -q is quiet' '