git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t5541-http-push: make grep expression check for one line only

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 25, 2010, 17:52 UTC
Message-ID
<7v1vhe3wdz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v7hr63wm7.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> 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.

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.
Previous: Junio C HamanoNext: Tay Ray Chuan
Message 3 of 5 in “t5541-http-push: make grep expression check for one line only”
  1. t5541-http-push: make grep expression check for one line onlyTay Ray Chuan, Jan 25, 2010
  2. Junio C HamanoJan 25, 2010
  3. Junio C HamanoJan 25, 2010
  4. Tay Ray ChuanJan 26, 2010
  5. t5541-http-push: make grep expression check for one line onlyTay Ray Chuan, Jan 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.