Skip to content

Commit 9567f08

Browse files
rctaygitster
authored andcommitted
t5541-http-push: make grep expression check for one line only
Don't feed a multiple-line pattern to grep and expect the them to match with lines in order. Simplify the grep expressions in the non-fast-forward tests to check only for the first line of the non-fast-forward warning - having that line should be enough assurance that the full warning is printed. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0aa958d commit 9567f08

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

t/t5541-http-push.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ test_expect_success 'non-fast-forward push show ref status' '
105105
'
106106

107107
test_expect_success 'non-fast-forward push shows help message' '
108-
grep \
109-
"To prevent you from losing history, non-fast-forward updates were rejected
110-
Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
111-
section of '"'git push --help'"' for details." output
108+
grep "To prevent you from losing history, non-fast-forward updates were rejected" \
109+
output
112110
'
113111

114112
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
@@ -126,10 +124,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
126124
grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
127125
grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
128126
129-
grep \
130-
"To prevent you from losing history, non-fast-forward updates were rejected
131-
Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
132-
section of '"'git push --help'"' for details." output
127+
grep "To prevent you from losing history, non-fast-forward updates were rejected" \
128+
output
133129
'
134130

135131
stop_httpd

0 commit comments

Comments
 (0)