Re: [PATCH v3 3/3] completion: 'git diff' completes untracked paths as a last resort

Junio C Hamano <[email protected]> Thu, 06 Aug 2026 08:06:45 -0700
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
"D. Ben Knoble" <[email protected]> writes:

>>  test_expect_success 'git -C <path> diff completes tracked paths in specified repo' '
>>         test_when_finished "rm -rf repo-for-diff" &&
>>         git init repo-for-diff &&
>> @@ -2744,11 +2754,21 @@ test_expect_success 'git -C <path> diff -- completes pathspecs in specified repo
>>         test_when_finished "rm -rf repo-for-diff" &&
>>         git init repo-for-diff &&
>>         echo content >repo-for-diff/otherfile &&
>> +       echo untracked >repo-for-diff/untracked &&
>>         git -C repo-for-diff add otherfile &&
>>         git -C repo-for-diff commit -m otherfile &&
>> -       test_completion "git -C repo-for-diff diff -- o" <<-\EOF
>> +       test_completion "git -C repo-for-diff diff o" <<-\EOF &&
>> +       otherfile
>> +       EOF
>
> Here, with more context (which I won't paste, because GMail…), it
> looks like this test is redundant with the test just before?

You're right.   As these prefix strings ('f', 'o', or 'u') tested
do not begin any valid refs, the result should be the same with or
without '--', and I wanted to test both in a single test block, but
I botched the conversion.

Will fix in v4, which hopefully will be test-only updates.

Thanks.