All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: git@vger.kernel.org,
	"Philippe Blain" <levraiphilippeblain@gmail.com>,
	"Britton Leo Kerin" <britton.kerin@gmail.com>,
	"Rubén Justo" <rjusto@gmail.com>,
	"Patrick Steinhardt" <ps@pks.im>,
	"D. Ben Knoble" <ben.knoble@gmail.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH v4 1/3] completion: no-op refactoring of diff completion
Date: Fri, 07 Aug 2026 08:09:08 -0700	[thread overview]
Message-ID: <xmqqpkzuezmz.fsf@gitster.g> (raw)
In-Reply-To: <CABPp-BHhNHBN0Mt0LVjGEcNL_y7mad7rS6NRX6p14ELrRD-+bg@mail.gmail.com> (Elijah Newren's message of "Thu, 6 Aug 2026 23:15:52 -0700")

Elijah Newren <newren@gmail.com> writes:

> On Thu, Aug 6, 2026 at 6:38 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> The "git diff" completion function punts very early when it sees
>> "--" on the command line, since it is a sign that options or
>> revisions can appear and the current completion does not need to do
>> anything "git diff" specific. By returning, it lets Bash default
>> action that completes the names of the files in $PWD to kick in.
>>
>> In preparation for the next step to change what happens when we
>> "punt", arrange the code flow to avoid this early return.  The
>> behaviour at this step is unchanged, but the control flow just
>> falls straight to the end.
>>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>>  contrib/completion/git-completion.bash | 61 ++++++++++++++------------
>>  1 file changed, 33 insertions(+), 28 deletions(-)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index e875787710..ccd3b2a372 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -1947,35 +1947,40 @@ __git_diff_difftool_options="--cached --staged
>>
>>  _git_diff ()
>>  {
> [...]
>> +       if ! __git_has_doubledash; then
>> +               case "$cur" in
>> +               --diff-algorithm=*)
>> +                       __gitcomp "$__git_diff_algorithms" \
>> +                               "" "${cur##--diff-algorithm=}"
>> +                       return
>>                 ;;
>
> The refactor in this commit is a faithful no-op -- every arm got
> re-indented by one tab as expected.  One tiny slip, though: this first
> case's ";;" didn't get the extra tab that every other arm received.

Good eyes.  Will fix.

  reply	other threads:[~2026-08-07 15:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  0:58 [PATCH] completion: complete tracked paths for 'git diff' Junio C Hamano
2026-08-03  1:07 ` Junio C Hamano
2026-08-03  5:44 ` SZEDER Gábor
2026-08-03 13:41   ` Junio C Hamano
2026-08-03 15:45     ` Junio C Hamano
2026-08-04 16:22 ` [PATCH v2] " Junio C Hamano
2026-08-05 19:42 ` [PATCH v3 0/3] completion of 'git [-C <dir>] diff' Junio C Hamano
2026-08-05 19:42   ` [PATCH v3 1/3] completion: no-op refactoring of diff completion Junio C Hamano
2026-08-05 19:42   ` [PATCH v3 2/3] completion: complete tracked paths for 'git diff' Junio C Hamano
2026-08-05 19:42   ` [PATCH v3 3/3] completion: 'git diff' completes untracked paths as a last resort Junio C Hamano
2026-08-06 11:30     ` D. Ben Knoble
2026-08-06 15:06       ` Junio C Hamano
2026-08-06 11:30   ` [PATCH v3 0/3] completion of 'git [-C <dir>] diff' D. Ben Knoble
2026-08-07  1:38 ` [PATCH v4 " Junio C Hamano
2026-08-07  1:38   ` [PATCH v4 1/3] completion: no-op refactoring of diff completion Junio C Hamano
2026-08-07  6:15     ` Elijah Newren
2026-08-07 15:09       ` Junio C Hamano [this message]
2026-08-07  1:38   ` [PATCH v4 2/3] completion: complete tracked paths for 'git diff' Junio C Hamano
2026-08-07  6:18     ` Elijah Newren
2026-08-07 11:02       ` D. Ben Knoble
2026-08-07 15:13       ` Junio C Hamano
2026-08-07 15:22         ` Elijah Newren
2026-08-07  1:38   ` [PATCH v4 3/3] completion: 'git diff' completes untracked paths as a last resort Junio C Hamano
2026-08-07  6:31   ` [PATCH v4 0/3] completion of 'git [-C <dir>] diff' Elijah Newren
2026-08-07 11:05     ` D. Ben Knoble
2026-08-07 16:19 ` [PATCH v5 " Junio C Hamano
2026-08-07 16:19   ` [PATCH v5 1/3] completion: no-op refactoring of diff completion Junio C Hamano
2026-08-07 16:19   ` [PATCH v5 2/3] completion: complete tracked paths for 'git diff' Junio C Hamano
2026-08-07 16:19   ` [PATCH v5 3/3] completion: 'git diff' completes untracked paths as a last resort Junio C Hamano
2026-08-07 16:53   ` [PATCH v5 0/3] completion of 'git [-C <dir>] diff' Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqpkzuezmz.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=britton.kerin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=levraiphilippeblain@gmail.com \
    --cc=newren@gmail.com \
    --cc=ps@pks.im \
    --cc=rjusto@gmail.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.