ci: skip GitHub workflow runs for already-tested commits/trees
[git.git] / t / t3417-rebase-whitespace-fix.sh
blob946e92f8dac84edcad260d4f7354b996e54b61ec
1 #!/bin/sh
3 test_description='git rebase --whitespace=fix
5 This test runs git rebase --whitespace=fix and make sure that it works.
8 . ./test-lib.sh
10 # prepare initial revision of "file" with a blank line at the end
11 cat >file <<EOF
16 EOF
18 # expected contents in "file" after rebase
19 cat >expect-first <<EOF
23 EOF
25 # prepare second revision of "file"
26 cat >second <<EOF
38 EOF
40 # expected contents in second revision after rebase
41 cat >expect-second <<EOF
49 EOF
51 test_expect_success 'blank line at end of file; extend at end of file' '
52 git commit --allow-empty -m "Initial empty commit" &&
53 git add file && git commit -m first &&
54 mv second file &&
55 git add file && git commit -m second &&
56 git rebase --whitespace=fix HEAD^^ &&
57 git diff --exit-code HEAD^:file expect-first &&
58 test_cmp expect-second file
61 # prepare third revision of "file"
62 sed -e's/Z//' >third <<EOF
77 EOF
79 sed -e's/ //g' <third >expect-third
81 test_expect_success 'two blanks line at end of file; extend at end of file' '
82 cp third file && git add file && git commit -m third &&
83 git rebase --whitespace=fix HEAD^^ &&
84 git diff --exit-code HEAD^:file expect-second &&
85 test_cmp expect-third file
88 test_expect_success 'same, but do not remove trailing spaces' '
89 git config core.whitespace "-blank-at-eol" &&
90 git reset --hard HEAD^ &&
91 cp third file && git add file && git commit -m third &&
92 git rebase --whitespace=fix HEAD^^ &&
93 git diff --exit-code HEAD^:file expect-second &&
94 test_cmp file third
97 sed -e's/Z//' >beginning <<EOF
103 cat >expect-beginning <<EOF
114 test_expect_success 'at beginning of file' '
115 git config core.whitespace "blank-at-eol" &&
116 cp beginning file &&
117 git commit -m beginning file &&
118 for i in 1 2 3 4 5; do
119 echo $i
120 done >> file &&
121 git commit -m more file &&
122 git rebase --whitespace=fix HEAD^^ &&
123 test_cmp expect-beginning file
126 test_done