3 test_description
='git rebase --whitespace=fix
5 This test runs git rebase --whitespace=fix and make sure that it works.
8 TEST_PASSES_SANITIZE_LEAK
=true
11 # prepare initial revision of "file" with a blank line at the end
19 # expected contents in "file" after rebase
20 cat >expect-first
<<EOF
26 # prepare second revision of "file"
41 # expected contents in second revision after rebase
42 cat >expect-second
<<EOF
52 test_expect_success
'blank line at end of file; extend at end of file' '
53 git commit --allow-empty -m "Initial empty commit" &&
54 git add file && git commit -m first &&
56 git add file && git commit -m second &&
57 git rebase --whitespace=fix HEAD^^ &&
58 git diff --exit-code HEAD^:file expect-first &&
59 test_cmp expect-second file
62 # prepare third revision of "file"
63 sed -e's/Z//' >third
<<EOF
80 sed -e's/ //g' <third
>expect-third
82 test_expect_success
'two blanks line at end of file; extend at end of file' '
83 cp third file && git add file && git commit -m third &&
84 git rebase --whitespace=fix HEAD^^ &&
85 git diff --exit-code HEAD^:file expect-second &&
86 test_cmp expect-third file
89 test_expect_success
'same, but do not remove trailing spaces' '
90 git config core.whitespace "-blank-at-eol" &&
91 git reset --hard HEAD^ &&
92 cp third file && git add file && git commit -m third &&
93 git rebase --whitespace=fix HEAD^^ &&
94 git diff --exit-code HEAD^:file expect-second &&
98 sed -e's/Z//' >beginning
<<EOF
104 cat >expect-beginning
<<EOF
115 test_expect_success
'at beginning of file' '
116 git config core.whitespace "blank-at-eol" &&
118 git commit -m beginning file &&
119 test_write_lines 1 2 3 4 5 >>file &&
120 git commit -m more file &&
121 git rebase --whitespace=fix HEAD^^ &&
122 test_cmp expect-beginning file