]>
Commit | Line | Data |
---|---|---|
ef484add RA |
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 | . "$TEST_DIRECTORY"/lib-rebase.sh | |
11 | ||
12 | # This is a special case in which both am and interactive backends | |
13 | # provide the same output. It was done intentionally because | |
14 | # both the backends fall short of optimal behaviour. | |
15 | test_expect_success 'setup' ' | |
16 | git checkout -b topic && | |
17 | test_write_lines "line 1" " line 2" "line 3" >file && | |
18 | git add file && | |
19 | git commit -m "add file" && | |
20 | ||
21 | test_write_lines "line 1" "new line 2" "line 3" >file && | |
22 | git commit -am "update file" && | |
23 | git tag side && | |
24 | ||
25 | git checkout --orphan master && | |
26 | test_write_lines "line 1" " line 2" "line 3" >file && | |
27 | git commit -am "add file" && | |
28 | git tag main | |
29 | ' | |
30 | ||
31 | test_expect_success '--ignore-whitespace works with apply backend' ' | |
32 | test_must_fail git rebase --apply main side && | |
33 | git rebase --abort && | |
34 | git rebase --apply --ignore-whitespace main side && | |
35 | git diff --exit-code side | |
36 | ' | |
37 | ||
38 | test_expect_success '--ignore-whitespace works with merge backend' ' | |
39 | test_must_fail git rebase --merge main side && | |
40 | git rebase --abort && | |
41 | git rebase --merge --ignore-whitespace main side && | |
42 | git diff --exit-code side | |
43 | ' | |
44 | ||
45 | test_expect_success '--ignore-whitespace is remembered when continuing' ' | |
46 | ( | |
47 | set_fake_editor && | |
48 | FAKE_LINES="break 1" git rebase -i --ignore-whitespace \ | |
49 | main side && | |
50 | git rebase --continue | |
51 | ) && | |
52 | git diff --exit-code side | |
53 | ' | |
54 | ||
55 | # This must be the last test in this file | |
56 | test_expect_success '$EDITOR and friends are unchanged' ' | |
57 | test_editor_unchanged | |
58 | ' | |
59 | ||
60 | test_done |