unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Tom Tromey <tom@tromey.com>, 25710@debbugs.gnu.org
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	[thread overview]
Message-ID: <8760jokjbt.fsf@tromey.com> (raw)
In-Reply-To: <ccf1a000-565f-7355-0b34-e933b44b6ba8@yandex.ru> (Dmitry Gutov's message of "Mon, 20 Feb 2017 00:13:26 +0200")

>>>>> "Dmitry" == Dmitry Gutov <dgutov@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)





  reply	other threads:[~2017-03-04 18:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 23:11 bug#25710: 25.1.91; vc-retrieve-tag does not offer branch namd completion Tom Tromey
     [not found] ` <handler.25710.B.148702752518881.ack@debbugs.gnu.org>
2017-02-14  3:13   ` bug#25710: Acknowledgement (25.1.91; vc-retrieve-tag does not offer branch namd completion) Tom Tromey
2017-02-14 10:24     ` Dmitry Gutov
     [not found]       ` <87inoczdun.fsf@tromey.com>
2017-02-14 23:31         ` Dmitry Gutov
2017-02-15  4:35           ` Tom Tromey
2017-02-17  1:26             ` Dmitry Gutov
2017-02-17  4:09               ` Tom Tromey
2017-02-19 22:13                 ` Dmitry Gutov
2017-03-04 18:06                   ` Tom Tromey [this message]
2017-03-06 11:42                     ` Dmitry Gutov
2020-08-11  7:56                       ` Stefan Kangas
2020-08-11 19:44                         ` Dmitry Gutov
2020-08-19 11:39                           ` Lars Ingebrigtsen
2017-02-16  3:38 ` bug#25710: Branch completion on vc-retrive-tag Artem Malyshev

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=8760jokjbt.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=25710@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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).