Skip to content

Commit 1c7969c

Browse files
moygitster
authored andcommitted
tests: don't set status.displayCommentPrefix file-wide
The previous commit set status.displayCommentPrefix file-wide in t7060-wtstatus.sh, t7508-status.sh and t/t7512-status-help.sh to make the patch small. However, now that status.displayCommentPrefix is not the default, it is better to disable it in tests so that the most common situation is also the most tested. While we're there, move the "cat > expect << EOF" blocks inside the tests. Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2556b99 commit 1c7969c

File tree

3 files changed

+793
-813
lines changed

3 files changed

+793
-813
lines changed

t/t7060-wtstatus.sh

Lines changed: 54 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ test_description='basic work tree status reporting'
44

55
. ./test-lib.sh
66

7-
test_expect_success 'use status.displayCommentPrefix by default ' '
8-
git config --global status.displayCommentPrefix true
9-
'
10-
117
test_expect_success setup '
128
git config --global advice.statusuoption false &&
139
test_commit A &&
@@ -33,20 +29,19 @@ test_expect_success 'Report new path with conflict' '
3329
test_cmp expect actual
3430
'
3531

36-
cat >expect <<EOF
37-
# On branch side
38-
# You have unmerged paths.
39-
# (fix conflicts and run "git commit")
40-
#
41-
# Unmerged paths:
42-
# (use "git add/rm <file>..." as appropriate to mark resolution)
43-
#
44-
# deleted by us: foo
45-
#
32+
test_expect_success 'M/D conflict does not segfault' '
33+
cat >expect <<EOF &&
34+
On branch side
35+
You have unmerged paths.
36+
(fix conflicts and run "git commit")
37+
38+
Unmerged paths:
39+
(use "git add/rm <file>..." as appropriate to mark resolution)
40+
41+
deleted by us: foo
42+
4643
no changes added to commit (use "git add" and/or "git commit -a")
4744
EOF
48-
49-
test_expect_success 'M/D conflict does not segfault' '
5045
mkdir mdconflict &&
5146
(
5247
cd mdconflict &&
@@ -139,19 +134,19 @@ test_expect_success 'status when conflicts with add and rm advice (deleted by th
139134
test_commit on_second main.txt on_second &&
140135
test_commit master conflict.txt master &&
141136
test_must_fail git merge second_branch &&
142-
cat >expected <<-\EOF &&
143-
# On branch master
144-
# You have unmerged paths.
145-
# (fix conflicts and run "git commit")
146-
#
147-
# Unmerged paths:
148-
# (use "git add/rm <file>..." as appropriate to mark resolution)
149-
#
150-
# both added: conflict.txt
151-
# deleted by them: main.txt
152-
#
153-
no changes added to commit (use "git add" and/or "git commit -a")
154-
EOF
137+
cat >expected <<\EOF &&
138+
On branch master
139+
You have unmerged paths.
140+
(fix conflicts and run "git commit")
141+
142+
Unmerged paths:
143+
(use "git add/rm <file>..." as appropriate to mark resolution)
144+
145+
both added: conflict.txt
146+
deleted by them: main.txt
147+
148+
no changes added to commit (use "git add" and/or "git commit -a")
149+
EOF
155150
git status --untracked-files=no >actual &&
156151
test_i18ncmp expected actual
157152
'
@@ -172,20 +167,20 @@ test_expect_success 'prepare for conflicts' '
172167

173168
test_expect_success 'status when conflicts with add and rm advice (both deleted)' '
174169
test_must_fail git merge conflict &&
175-
cat >expected <<-\EOF &&
176-
# On branch conflict_second
177-
# You have unmerged paths.
178-
# (fix conflicts and run "git commit")
179-
#
180-
# Unmerged paths:
181-
# (use "git add/rm <file>..." as appropriate to mark resolution)
182-
#
183-
# both deleted: main.txt
184-
# added by them: sub_master.txt
185-
# added by us: sub_second.txt
186-
#
187-
no changes added to commit (use "git add" and/or "git commit -a")
188-
EOF
170+
cat >expected <<\EOF &&
171+
On branch conflict_second
172+
You have unmerged paths.
173+
(fix conflicts and run "git commit")
174+
175+
Unmerged paths:
176+
(use "git add/rm <file>..." as appropriate to mark resolution)
177+
178+
both deleted: main.txt
179+
added by them: sub_master.txt
180+
added by us: sub_second.txt
181+
182+
no changes added to commit (use "git add" and/or "git commit -a")
183+
EOF
189184
git status --untracked-files=no >actual &&
190185
test_i18ncmp expected actual
191186
'
@@ -196,22 +191,22 @@ test_expect_success 'status when conflicts with only rm advice (both deleted)' '
196191
test_must_fail git merge conflict &&
197192
git add sub_master.txt &&
198193
git add sub_second.txt &&
199-
cat >expected <<-\EOF &&
200-
# On branch conflict_second
201-
# You have unmerged paths.
202-
# (fix conflicts and run "git commit")
203-
#
204-
# Changes to be committed:
205-
#
206-
# new file: sub_master.txt
207-
#
208-
# Unmerged paths:
209-
# (use "git rm <file>..." to mark resolution)
210-
#
211-
# both deleted: main.txt
212-
#
213-
# Untracked files not listed (use -u option to show untracked files)
214-
EOF
194+
cat >expected <<\EOF &&
195+
On branch conflict_second
196+
You have unmerged paths.
197+
(fix conflicts and run "git commit")
198+
199+
Changes to be committed:
200+
201+
new file: sub_master.txt
202+
203+
Unmerged paths:
204+
(use "git rm <file>..." to mark resolution)
205+
206+
both deleted: main.txt
207+
208+
Untracked files not listed (use -u option to show untracked files)
209+
EOF
215210
git status --untracked-files=no >actual &&
216211
test_i18ncmp expected actual &&
217212
git reset --hard &&

0 commit comments

Comments
 (0)