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

Re: [PATCH] git: avoid segfault on "git --shallow-file" without a value

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2026, 17:13 UTC
Message-ID
<xmqqecg3xnwx.fsf@gitster.g>
In-Reply-To
<CAP8UFD1BoXTo-bNyaQeWeC1QhrpdBAOOW4BwXCi9XYMr7aRuZw@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 24 quoted lines
>> Just being
>> curious, because (1) if there are, this addition belongs there, not
>> here,
> ...
>> and (2) if there aren't, this addition may not be needed, and
>> (3) if there aren't or if the existing coverage is incomplete,
>> perhaps we should give a more complete coverage while at it.
>>
>> With (3), I mean something along the lines of ...
>>
>>         for opt in -C -c --git-dir --work-tree --namespace --config-env
>>         do
>>                 test_expect_success "git $opt without a value" '
>>                         test_must_fail git $opt >actual 2>error &&
>>                         test_line_count 0 actual &&
>>                         test_grep usage error
>>                 '
>>         done
>>
>> I do not mean to say that (3) is my favorite among these three,
>> though.
>
> I am fine with (2) or (3), but they don't seem much better to me than
> the test already in this patch.

I think this is the case between (1) and (2), there is not much coverage, and there is no coverage specific to "git potty" options.

The 't0041' test is a suitable place if we eventually aim for more complete coverage such as (3), instead of piecemeal tests, such as 'test --config option with other config-related things in t1300' and 'test --shallow-file option with other shallow-related things in t????'. So I think the patch is fine as-is. I will just leave a '#leftoverbits' comment here to remind others to consider whether it is worth extending the test to cover more 'git potty' options for completeness in the future.

Thanks.
Previous: Christian CouderNext: Patrick Steinhardt
Message 4 of 7 in “git: avoid segfault on "git --shallow-file" without a value”
  1. git: avoid segfault on "git --shallow-file" without a valueChristian Couder, Aug 11, 2026
  2. Junio C HamanoAug 11, 2026
  3. Christian CouderAug 12, 2026
  4. Junio C HamanoAug 12, 2026
  5. Patrick SteinhardtAug 12, 2026
  6. Christian CouderAug 12, 2026
  7. Patrick SteinhardtAug 13, 2026

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.