summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Rohit Ashiwal <rohit.ashiwal265@gmail.com>2019-11-01 19:29:58 +0530
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-11-02 15:34:50 +0900
commitba51d2fb24b1a41b8cc15270a06f24c35c0fcf19 (patch)
tree5e2e5df2b87f8ff3d0a6a80adfd88234529833c1 /t
parentsequencer: simplify root commit creation (diff)
downloadtgif-ba51d2fb24b1a41b8cc15270a06f24c35c0fcf19.tar.xz
rebase -i: add --ignore-whitespace flag
There are two backends available for rebasing, viz, the am and the interactive. Naturally, there shall be some features that are implemented in one but not in the other. One such flag is --ignore-whitespace which indicates merge mechanism to treat lines with only whitespace changes as unchanged. Wire the interactive rebase to also understand the --ignore-whitespace flag by translating it to -Xignore-space-change. Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3422-rebase-incompatible-options.sh1
-rwxr-xr-xt/t3433-rebase-options-compatibility.sh65
2 files changed, 65 insertions, 1 deletions
diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh
index a5868ea152..4342f79eea 100755
--- a/t/t3422-rebase-incompatible-options.sh
+++ b/t/t3422-rebase-incompatible-options.sh
@@ -61,7 +61,6 @@ test_rebase_am_only () {
}
test_rebase_am_only --whitespace=fix
-test_rebase_am_only --ignore-whitespace
test_rebase_am_only --committer-date-is-author-date
test_rebase_am_only -C4
diff --git a/t/t3433-rebase-options-compatibility.sh b/t/t3433-rebase-options-compatibility.sh
new file mode 100755
index 0000000000..2e16e00a9d
--- /dev/null
+++ b/t/t3433-rebase-options-compatibility.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 Rohit Ashiwal
+#
+
+test_description='tests to ensure compatibility between am and interactive backends'
+
+. ./test-lib.sh
+
+# This is a special case in which both am and interactive backends
+# provide the same output. It was done intentionally because
+# both the backends fall short of optimal behaviour.
+test_expect_success 'setup' '
+ git checkout -b topic &&
+ q_to_tab >file <<-\EOF &&
+ line 1
+ Qline 2
+ line 3
+ EOF
+ git add file &&
+ git commit -m "add file" &&
+ cat >file <<-\EOF &&
+ line 1
+ new line 2
+ line 3
+ EOF
+ git commit -am "update file" &&
+ git tag side &&
+
+ git checkout --orphan master &&
+ sed -e "s/^|//" >file <<-\EOF &&
+ |line 1
+ | line 2
+ |line 3
+ EOF
+ git add file &&
+ git commit -m "add file" &&
+ git tag main
+'
+
+test_expect_success '--ignore-whitespace works with am backend' '
+ cat >expect <<-\EOF &&
+ line 1
+ new line 2
+ line 3
+ EOF
+ test_must_fail git rebase main side &&
+ git rebase --abort &&
+ git rebase --ignore-whitespace main side &&
+ test_cmp expect file
+'
+
+test_expect_success '--ignore-whitespace works with interactive backend' '
+ cat >expect <<-\EOF &&
+ line 1
+ new line 2
+ line 3
+ EOF
+ test_must_fail git rebase --merge main side &&
+ git rebase --abort &&
+ git rebase --merge --ignore-whitespace main side &&
+ test_cmp expect file
+'
+
+test_done