bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25710: Acknowledgement (25.1.91; vc-retrieve-tag does not offer bran


From: Tom Tromey
Subject: bug#25710: Acknowledgement (25.1.91; vc-retrieve-tag does not offer branch namd completion)
Date: Sat, 04 Mar 2017 11:06:30 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

>>>>> "Dmitry" == Dmitry Gutov <address@hidden> writes:

Dmitry> Will it change how vc-git-revision-completion-table works,
Dmitry> across all commands? If so, I'm good with it.

Yeah.  What do you think of the appended?

Tom

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..d20b10e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -180,6 +180,16 @@ vc-git-log-output-coding-system
   :type '(coding-system :tag "Coding system to decode Git log output")
   :version "25.1")
 
+(defcustom vc-git-revision-complete-only-branches nil
+  "Control whether tags are returned by revision completion for Git.
+
+When non-nil, only branches and remotes will be returned by
+`vc-git-revision-completion-table'.  This is used by various VC
+commands when completing branch names.  When nil, tags are also
+included in the completions."
+  :type 'boolean
+  :version "26.1")
+
 ;; History of Git commands.
 (defvar vc-git-history nil)
 
@@ -1187,9 +1197,11 @@ vc-git-revision-table
     (with-temp-buffer
       (vc-git-command t nil nil "for-each-ref" "--format=%(refname)")
       (goto-char (point-min))
-      (while (re-search-forward "^refs/\\(heads\\|tags\\|remotes\\)/\\(.*\\)$"
-                                nil t)
-        (push (match-string 2) table)))
+      (let ((regexp (if vc-git-revision-complete-only-branches
+                        "^refs/\\(heads\\|remotes\\)/\\(.*\\)$"
+                      "^refs/\\(heads\\|tags\\|remotes\\)/\\(.*\\)$")))
+        (while (re-search-forward regexp nil t)
+          (push (match-string 2) table))))
     table))
 
 (defun vc-git-revision-completion-table (files)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]