Skip to content

Commit 18acb30

Browse files
jrngitster
authored andcommitted
t6038 (merge.renormalize): style nitpicks
Some tweaks to simplify adding and running tests. - Use test_tick for predictable, sort of realistic commit dates; - Use test_cmp as "test_cmp expected actual" --- some crazy content that was not expected should cause the test to fail; - Remove and re-add all files at the start of each test so the worktree is easier to think about; - Avoid using cat where not necessary for clarity. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 43dd233 commit 18acb30

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

t/t6038-merge-text-auto.sh

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,94 @@
11
#!/bin/sh
22

3-
test_description='CRLF merge conflict across text=auto change'
3+
test_description='CRLF merge conflict across text=auto change
4+
5+
* [master] remove .gitattributes
6+
! [side] add line from b
7+
--
8+
+ [side] add line from b
9+
* [master] remove .gitattributes
10+
* [master^] add line from a
11+
* [master~2] normalize file
12+
*+ [side^] Initial
13+
'
414

515
. ./test-lib.sh
616

717
test_expect_success setup '
818
git config merge.renormalize true &&
919
git config core.autocrlf false &&
20+
1021
echo first line | append_cr >file &&
1122
echo first line >control_file &&
1223
echo only line >inert_file &&
24+
1325
git add file control_file inert_file &&
26+
test_tick &&
1427
git commit -m "Initial" &&
1528
git tag initial &&
1629
git branch side &&
30+
1731
echo "* text=auto" >.gitattributes &&
1832
touch file &&
1933
git add .gitattributes file &&
34+
test_tick &&
2035
git commit -m "normalize file" &&
36+
2137
echo same line | append_cr >>file &&
2238
echo same line >>control_file &&
2339
git add file control_file &&
40+
test_tick &&
2441
git commit -m "add line from a" &&
2542
git tag a &&
43+
2644
git rm .gitattributes &&
2745
rm file &&
2846
git checkout file &&
47+
test_tick &&
2948
git commit -m "remove .gitattributes" &&
3049
git tag c &&
50+
3151
git checkout side &&
3252
echo same line | append_cr >>file &&
3353
echo same line >>control_file &&
3454
git add file control_file &&
55+
test_tick &&
3556
git commit -m "add line from b" &&
3657
git tag b &&
58+
3759
git checkout master
3860
'
3961

40-
test_expect_success 'Check merging after setting text=auto' '
62+
test_expect_success 'Merge after setting text=auto' '
63+
cat <<-\EOF >expected &&
64+
first line
65+
same line
66+
EOF
67+
68+
git rm -fr . &&
69+
rm -f .gitattributes &&
4170
git reset --hard a &&
4271
git merge b &&
43-
cat file | remove_cr >file.temp &&
44-
test_cmp file file.temp
72+
test_cmp expected file
4573
'
4674

47-
test_expect_success 'Check merging addition of text=auto' '
75+
test_expect_success 'Merge addition of text=auto' '
76+
cat <<-\EOF >expected &&
77+
first line
78+
same line
79+
EOF
80+
81+
git rm -fr . &&
82+
rm -f .gitattributes &&
4883
git reset --hard b &&
4984
git merge a &&
50-
cat file | remove_cr >file.temp &&
51-
test_cmp file file.temp
85+
test_cmp expected file
5286
'
5387

5488
test_expect_success 'Test delete/normalize conflict' '
55-
git checkout side &&
89+
git checkout -f side &&
90+
git rm -fr . &&
91+
rm -f .gitattributes &&
5692
git reset --hard initial &&
5793
git rm file &&
5894
git commit -m "remove file" &&

0 commit comments

Comments
 (0)