Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Re: Bug: wrong completion for 'git rerere forget'
- X-seq: zsh-workers 51313
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Cc: ronso0 <ronso0@xxxxxxxxx>
- Subject: [PATCH] Re: Bug: wrong completion for 'git rerere forget'
- Date: Mon, 16 Jan 2023 20:05:17 -0800
- Archived-at: <https://zsh.org/workers/51313>
- In-reply-to: <b41a1792-bd0d-a8c8-cf97-a623a0d6332f@mixxx.org>
- List-id: <zsh-workers.zsh.org>
- References: <b41a1792-bd0d-a8c8-cf97-a623a0d6332f@mixxx.org>
On Mon, Dec 5, 2022 at 4:02 PM ronso0 <ronso0@xxxxxxxxx> 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?
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]' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author