GNU bug report logs - #25710
25.1.91; vc-retrieve-tag does not offer branch namd completion

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Mon, 13 Feb 2017 23:13:02 UTC

Severity: wishlist

Tags: fixed, patch

Found in version 25.1.91

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 25710 <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Tom Tromey <tom <at> tromey.com>, 25710 <at> debbugs.gnu.org
Subject: Re: bug#25710: Acknowledgement (25.1.91;
 vc-retrieve-tag does not offer branch namd completion)
Date: Sat, 04 Mar 2017 11:06:30 -0700
>>>>> "Dmitry" == Dmitry Gutov <dgutov <at> yandex.ru> 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)




This bug report was last modified 4 years and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.