Add a variable to control VC completion over branch names
* lisp/vc/vc-git.el (vc-git-revision-complete-only-branches): New variable (bug#25710). (vc-git-revision-table): Use it.
This commit is contained in:
parent
3b8dfc46ce
commit
ed96a2121d
2 changed files with 19 additions and 3 deletions
4
etc/NEWS
4
etc/NEWS
|
@ -259,6 +259,10 @@ invoke 'C-u C-x v s' ('vc-create-tag').
|
|||
---
|
||||
*** 'vc-hg' now uses 'hg summary' to populate extra 'vc-dir' headers.
|
||||
|
||||
---
|
||||
*** New variable 'vc-git-revision-complete-only-branches'
|
||||
If non-nil, only branches and remotes are considered when doing
|
||||
completion over branch names.
|
||||
|
||||
** Gnus
|
||||
|
||||
|
|
|
@ -210,6 +210,16 @@ toggle display of the entire list."
|
|||
widget))))
|
||||
:version "27.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 "28.1")
|
||||
|
||||
;; History of Git commands.
|
||||
(defvar vc-git-history nil)
|
||||
|
||||
|
@ -1415,9 +1425,11 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
|
|||
(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)
|
||||
|
|
Loading…
Add table
Reference in a new issue