@matheusbsbs / matheus-bagliano / commits / 18acb30ee4
Fork 0

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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Aug 5, 2010 at 06:09 UTC 18acb30ee458a4a413d987215af41b4a76643f5d
1 file changed +44 -8
t/t6038-merge-text-auto.sh
+44 -8
@@ -1,58 +1,94 @@
1 #!/bin/sh
2
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 +'
14
15 . ./test-lib.sh
16
17 test_expect_success setup '
18 git config merge.renormalize true &&
19 git config core.autocrlf false &&
20 +
21 echo first line | append_cr >file &&
22 echo first line >control_file &&
23 echo only line >inert_file &&
24 +
25 git add file control_file inert_file &&
26 + test_tick &&
27 git commit -m "Initial" &&
28 git tag initial &&
29 git branch side &&
30 +
31 echo "* text=auto" >.gitattributes &&
32 touch file &&
33 git add .gitattributes file &&
34 + test_tick &&
35 git commit -m "normalize file" &&
36 +
37 echo same line | append_cr >>file &&
38 echo same line >>control_file &&
39 git add file control_file &&
40 + test_tick &&
41 git commit -m "add line from a" &&
42 git tag a &&
43 +
44 git rm .gitattributes &&
45 rm file &&
46 git checkout file &&
47 + test_tick &&
48 git commit -m "remove .gitattributes" &&
49 git tag c &&
50 +
51 git checkout side &&
52 echo same line | append_cr >>file &&
53 echo same line >>control_file &&
54 git add file control_file &&
55 + test_tick &&
56 git commit -m "add line from b" &&
57 git tag b &&
58 +
59 git checkout master
60 '
61
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 &&
70 git reset --hard a &&
71 git merge b &&
43 - cat file | remove_cr >file.temp &&
44 - test_cmp file file.temp
72 + test_cmp expected file
73 '
74
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 &&
83 git reset --hard b &&
84 git merge a &&
50 - cat file | remove_cr >file.temp &&
51 - test_cmp file file.temp
85 + test_cmp expected file
86 '
87
88 test_expect_success 'Test delete/normalize conflict' '
55 - git checkout side &&
89 + git checkout -f side &&
90 + git rm -fr . &&
91 + rm -f .gitattributes &&
92 git reset --hard initial &&
93 git rm file &&
94 git commit -m "remove file" &&