Re: [PATCH] t5541-http-push: make grep expression check for one line only
- From
Tay Ray Chuan <rctay89@gmail.com>
- Date
- Jan 26, 2010, 01:33 UTC
- Message-ID
- <be6fef0d1001251733o57042a99q9f1f8b6e849187ee@mail.gmail.com>
- In-Reply-To
- <7v1vhe3wdz.fsf@alter.siamese.dyndns.org>
Hi,
On Tue, Jan 26, 2010 at 1:52 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: > >> Tay Ray Chuan <rctay89@gmail.com> writes: >> >>> 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. >>> >>> In the first place, grep can't deal with expressions for multiple >>> lines. >> >> This shows that nobody has ever run this test since January 8th, not even >> the original author? >> >> Hmmm. > > Actually, if you grep with a pattern with multiple lines, it is equivalent > to giving each of these lines as a separate pattern from the command line. > So it is understandable that the tests passed. They were checking if > these match, but it doesn't check (and grep is not designed to) if the > first pattern matched the first line, the second to second, etc.
that was why the tests passed then and passed now - I just happened to run them, and I noticed grep reported success, yet only matched 2 of the 3 lines. Then I remembered recently there had been a rewording of the fast-forward warning was reworded (c0eb604 "push: spell 'Note about fast-forwards'")...
Show 12 quoted lines
> So I'd say something like... > > Don't feed multiple-line pattern to grep and expect 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> > > instead.
No problem.
-- Cheers, Ray Chuan