sequencer: allow callers of read_author_script() to ignore fields
[git] / t / t3433-rebase-options-compatibility.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 Rohit Ashiwal
4 #
5
6 test_description='tests to ensure compatibility between am and interactive backends'
7
8 . ./test-lib.sh
9
10 # This is a special case in which both am and interactive backends
11 # provide the same output. It was done intentionally because
12 # both the backends fall short of optimal behaviour.
13 test_expect_success 'setup' '
14         git checkout -b topic &&
15         q_to_tab >file <<-\EOF &&
16         line 1
17         Qline 2
18         line 3
19         EOF
20         git add file &&
21         git commit -m "add file" &&
22         cat >file <<-\EOF &&
23         line 1
24         new line 2
25         line 3
26         EOF
27         git commit -am "update file" &&
28         git tag side &&
29
30         git checkout --orphan master &&
31         sed -e "s/^|//" >file <<-\EOF &&
32         |line 1
33         |        line 2
34         |line 3
35         EOF
36         git add file &&
37         git commit -m "add file" &&
38         git tag main
39 '
40
41 test_expect_success '--ignore-whitespace works with am backend' '
42         cat >expect <<-\EOF &&
43         line 1
44         new line 2
45         line 3
46         EOF
47         test_must_fail git rebase main side &&
48         git rebase --abort &&
49         git rebase --ignore-whitespace main side &&
50         test_cmp expect file
51 '
52
53 test_expect_success '--ignore-whitespace works with interactive backend' '
54         cat >expect <<-\EOF &&
55         line 1
56         new line 2
57         line 3
58         EOF
59         test_must_fail git rebase --merge main side &&
60         git rebase --abort &&
61         git rebase --merge --ignore-whitespace main side &&
62         test_cmp expect file
63 '
64
65 test_done