summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t3400-rebase.sh27
-rwxr-xr-xt/t3403-rebase-skip.sh5
-rwxr-xr-xt/t3407-rebase-abort.sh10
-rwxr-xr-xt/t3418-rebase-continue.sh55
4 files changed, 88 insertions, 9 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 349eebd..6eaecec 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -158,15 +158,24 @@ test_expect_success 'Show verbose error when HEAD could not be detached' '
'
rm -f B
-test_expect_success 'dump usage when upstream arg is missing' '
- git checkout -b usage topic &&
- test_must_fail git rebase 2>error1 &&
- grep "[Uu]sage" error1 &&
- test_must_fail git rebase --abort 2>error2 &&
- grep "No rebase in progress" error2 &&
- test_must_fail git rebase --onto master 2>error3 &&
- grep "[Uu]sage" error3 &&
- ! grep "can.t shift" error3
+test_expect_success 'fail when upstream arg is missing and not on branch' '
+ git checkout topic &&
+ test_must_fail git rebase >output.out &&
+ grep "You are not currently on a branch" output.out
+'
+
+test_expect_success 'fail when upstream arg is missing and not configured' '
+ git checkout -b no-config topic &&
+ test_must_fail git rebase >output.out &&
+ grep "branch.no-config.merge" output.out
+'
+
+test_expect_success 'default to @{upstream} when upstream arg is missing' '
+ git checkout -b default topic &&
+ git config branch.default.remote .
+ git config branch.default.merge refs/heads/master
+ git rebase &&
+ test "$(git rev-parse default~1)" = "$(git rev-parse master)"
'
test_expect_success 'rebase -q is quiet' '
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index 64446e3..826500b 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -35,6 +35,11 @@ test_expect_success 'rebase with git am -3 (default)' '
test_must_fail git rebase master
'
+test_expect_success 'rebase --skip can not be used with other options' '
+ test_must_fail git rebase -v --skip &&
+ test_must_fail git rebase --skip -v
+'
+
test_expect_success 'rebase --skip with am -3' '
git rebase --skip
'
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index e573dc8..a6a6c40 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -84,6 +84,16 @@ testrebase() {
test_cmp reflog_before reflog_after &&
rm reflog_before reflog_after
'
+
+ test_expect_success 'rebase --abort can not be used with other options' '
+ cd "$work_dir" &&
+ # Clean up the state from the previous one
+ git reset --hard pre-rebase &&
+ test_must_fail git rebase$type master &&
+ test_must_fail git rebase -v --abort &&
+ test_must_fail git rebase --abort -v &&
+ git rebase --abort
+ '
}
testrebase "" .git/rebase-apply
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 3b0d273..1e855cd 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -40,4 +40,59 @@ test_expect_success 'non-interactive rebase --continue works with touched file'
git rebase --continue
'
+test_expect_success 'rebase --continue can not be used with other options' '
+ test_must_fail git rebase -v --continue &&
+ test_must_fail git rebase --continue -v
+'
+
+test_expect_success 'rebase --continue remembers merge strategy and options' '
+ rm -fr .git/rebase-* &&
+ git reset --hard commit-new-file-F2-on-topic-branch &&
+ test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
+ test_when_finished "rm -fr test-bin funny.was.run" &&
+ mkdir test-bin &&
+ cat >test-bin/git-merge-funny <<-EOF
+ #!$SHELL_PATH
+ case "\$1" in --opt) ;; *) exit 2 ;; esac
+ shift &&
+ >funny.was.run &&
+ exec git merge-recursive "\$@"
+ EOF
+ chmod +x test-bin/git-merge-funny &&
+ (
+ PATH=./test-bin:$PATH
+ test_must_fail git rebase -s funny -Xopt master topic
+ ) &&
+ test -f funny.was.run &&
+ rm funny.was.run &&
+ echo "Resolved" >F2 &&
+ git add F2 &&
+ (
+ PATH=./test-bin:$PATH
+ git rebase --continue
+ ) &&
+ test -f funny.was.run
+'
+
+test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
+ rm -fr .git/rebase-* &&
+ git reset --hard commit-new-file-F3-on-topic-branch &&
+ git checkout master
+ test_commit "commit-new-file-F3" F3 3 &&
+ git config rerere.enabled true &&
+ test_must_fail git rebase -m master topic &&
+ echo "Resolved" >F2 &&
+ git add F2 &&
+ test_must_fail git rebase --continue &&
+ echo "Resolved" >F3 &&
+ git add F3 &&
+ git rebase --continue &&
+ git reset --hard topic@{1} &&
+ test_must_fail git rebase -m --rerere-autoupdate master &&
+ test "$(cat F2)" = "Resolved" &&
+ test_must_fail git rebase --continue &&
+ test "$(cat F3)" = "Resolved" &&
+ git rebase --continue
+'
+
test_done