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

Re: [PATCH] blame: prevent a segv when -L given start > EOF

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 9, 2010, 17:55 UTC
Message-ID
<76718491002090955g66eca03ar7438e57811616267@mail.gmail.com>
In-Reply-To
<4B71122F.3040809@viscovery.net>
On Tue, Feb 9, 2010 at 2:43 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 18 quoted lines
> Jay Soffian schrieb:
>> +test_expect_success 'blame -L with invalid start' '
>> +     test_must_fail git blame -L5 tres 2>&1 | grep "has only 2 lines"
>
> Please write this as
>
>        test_must_fail git blame -L5 tres >output 2>&1 &&
>        grep "has only 2 lines" output
>
>> +'
>> +
>> +test_expect_success 'blame -L with invalid end' '
>> +     git blame -L1,5 tres 2>&1 | grep "has only 2 lines"
>
>        test_must_fail git blame -L1,5 tres >output 2>&1 &&
>        grep "has only 2 lines" output
>
> because shells look only at the exit code of the last command in a pipeline.

Thanks, I knew that. I'd left in test_must_fail accidentally because initially I wasn't bothering to grep the output. I then added the grep and forgot to remove test_must_fail. Isn't this an adequate test:

  test_expect_success 'blame -L with invalid start' '
     git blame -L5 tres 2>&1 | grep "has only 2 lines"

As it seems unlikely git would crash and still output the message correctly in this case.

?
j.
Previous: Johannes SixtNext: Junio C Hamano
Message 9 of 11 in “blame: prevent a segv when -L given start > EOF”
  1. blame: prevent a segv when -L given start > EOFJay Soffian, Feb 9, 2010
  2. Jay SoffianFeb 9, 2010
  3. Junio C HamanoFeb 9, 2010
  4. Jay SoffianFeb 9, 2010
  5. Jay SoffianFeb 9, 2010
  6. Jay SoffianFeb 9, 2010
  7. Junio C HamanoFeb 9, 2010
  8. Johannes SixtFeb 9, 2010
  9. Jay SoffianFeb 9, 2010
  10. Junio C HamanoFeb 9, 2010
  11. blame: prevent a segv when -L given start > EOFJay Soffian, Feb 9, 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.