From: Peter Seibel Date: Sat, 18 Jan 2025 15:54:51 +0000 (-0800) Subject: Improved git-add completion X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7ee516f7d89498a187f86f0e4c84128870032aab;p=emacs.git Improved git-add completion * lisp/pcmpl-git.el (pcomplete/git)): Complete untracked files. (Bug#75336) Copyright-paperwork-exempt: yes (cherry picked from commit 2fd72a6ed3f6ea2937b38a4d74d93e8cfa1a54fb) --- diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el index 1c2b71bad8a..a9a4f2b20f5 100644 --- a/lisp/pcmpl-git.el +++ b/lisp/pcmpl-git.el @@ -82,8 +82,18 @@ 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 and + ;; ignored files if -f or --force is specified. + ("add" + (pcomplete-here + (pcomplete-entries + 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 "add" "commit" "restore") + ((or "commit" "restore") (pcomplete-here (pcomplete-entries nil (pcmpl-git--tracked-file-predicate "-m"))))