zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Cc: ronso0 <ronso0@mixxx.org>
Subject: [PATCH] Re: Bug: wrong completion for 'git rerere forget'
Date: Mon, 16 Jan 2023 20:05:17 -0800	[thread overview]
Message-ID: <CAH+w=7Y6edNtAq-VJcOLDVhLiSM+m8gepD9_RuvEC2SrXvh2+w@mail.gmail.com> (raw)
In-Reply-To: <b41a1792-bd0d-a8c8-cf97-a623a0d6332f@mixxx.org>

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Mon, Dec 5, 2022 at 4:02 PM ronso0 <ronso0@mixxx.org> wrote:
>
> "git rerere forg"<Tab> completes to "git rerere forget=" (should be just "git rerere forget " with a trailing space)

This has been present ever since Nikolai Weibull's git completion was
imported in early 2011.  The comment preceding a call to _values is:

# TODO: This isn’t optimal, as forget get confused.

The attached is a bit of a hack but seems to do the right thing.  Thoughts?

[-- Attachment #2: git-rerere.txt --]
[-- Type: text/plain, Size: 1042 bytes --]

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 14fa01436..b3ed7b5c8 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -4259,14 +4259,14 @@ _git-rerere () {
 
   _arguments -C -S -s $endopt \
     '--rerere-autoupdate[register clean resolutions in index]' \
-    ': :->command' && ret=0
+    ': :->command' \
+    '*: :{ [[ $words[CURRENT-1] = forget ]] && __git_cached_files }' && ret=0
 
   case $state in
     (command)
-      # TODO: This isn't optimal, as forget get confused.
       _values command \
         'clear[reset metadata used by rerere]' \
-        'forget[resets metadata used by rerere for specific conflict]: :__git_cached_files' \
+        'forget[resets metadata used by rerere for specific conflict]' \
         'diff[output diffs for the current state of the resolution]' \
         'status[print paths with conflicts whose merge resolution rerere will record]' \
         'remaining[print paths with conflicts that have not been autoresolved by rerere]' \

      reply	other threads:[~2023-01-17  4:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  0:00 ronso0
2023-01-17  4:05 ` Bart Schaefer [this message]

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='CAH+w=7Y6edNtAq-VJcOLDVhLiSM+m8gepD9_RuvEC2SrXvh2+w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=ronso0@mixxx.org \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).