From: Peter Seibel <peter@gigamonkeys.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>,
Augusto Stoffel <arstoffel@gmail.com>,
75336@debbugs.gnu.org
Subject: bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
Date: Sat, 4 Jan 2025 07:52:07 -0800 [thread overview]
Message-ID: <CALHiJMa5EucGeivJ5K3v-ivZernyZZ0YPep3JM7dLwcqFn8G=Q@mail.gmail.com> (raw)
In-Reply-To: <jwv8qrqsk0t.fsf-monnier+emacs@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 967 bytes --]
Okay, here's an updated patch to also complete ignored files when -f or
--force is specified.
If you want I can rebase and make a single patch.
On Sat, Jan 4, 2025 at 7:04 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> >> > I was going a bit crazy trying to figure out why tab completion in
> >> > *shell* wasn't working for git add when I was trying to add a new
> >> > file to my repo. Turns out pcomplete was only completing modified
> >> > tracked files. This patch changes it so after git add it also
> >> > completes untracked non-ignored files.
> >> Augusto and Stefan, any comments?
>
> The (new) patch looks good to me.
>
> FWIW, it also makes sense occasionally to `git add` ignored files
> (e.g. we could want to track a `.elc` file in the test suite inside the
> Emacs repository to check how we handle specific old-format `.elc`
> files).
>
>
> Stefan
>
>
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #1.2: Type: text/html, Size: 1579 bytes --]
[-- Attachment #2: 0003-Complete-ignored-files-when-force-specified-in-git-a.patch --]
[-- Type: application/octet-stream, Size: 1570 bytes --]
From ec55556505a47ff61d38d6c8bc5e589b02def884 Mon Sep 17 00:00:00 2001
From: Peter Seibel <peter@gigamonkeys.com>
Date: Sat, 4 Jan 2025 07:48:09 -0800
Subject: [PATCH 3/3] Complete ignored files when force specified in git add.
---
lisp/pcmpl-git.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el
index ab5e3305865..f23002df28b 100644
--- a/lisp/pcmpl-git.el
+++ b/lisp/pcmpl-git.el
@@ -82,11 +82,16 @@ Files listed by `git ls-files ARGS' satisfy the predicate."
(pcomplete-from-help `(,vc-git-program "help" ,subcmd)
:argument
"-+\\(?:\\[no-\\]\\)?[a-z-]+=?"))))
- ;; Complete modified tracked files and untracked files
+ ;; Complete modified tracked files and untracked files and
+ ;; ignored files if -f or --force is specified.
("add"
(pcomplete-here
(pcomplete-entries
- nil (pcmpl-git--tracked-file-predicate "-o" "--exclude-standard" "-m"))))
+ nil
+ (let ((flags (list "-o" "-m")))
+ (unless (or (member "-f" pcomplete-args) (member "--force" pcomplete-args))
+ (push "--exclude-standard" flags))
+ (apply #'pcmpl-git--tracked-file-predicate flags)))))
;; Complete modified tracked files
((or "commit" "restore")
(pcomplete-here
--
2.47.1
prev parent reply other threads:[~2025-01-04 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 0:00 bug#75336: [PATCH] Allow pcomplete of git add to include untracked files Peter Seibel
2025-01-04 7:52 ` Eli Zaretskii
2025-01-04 7:54 ` Eli Zaretskii
2025-01-04 13:59 ` Peter Seibel
2025-01-04 15:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04 15:52 ` Peter Seibel [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALHiJMa5EucGeivJ5K3v-ivZernyZZ0YPep3JM7dLwcqFn8G=Q@mail.gmail.com' \
--to=peter@gigamonkeys.com \
--cc=75336@debbugs.gnu.org \
--cc=arstoffel@gmail.com \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).