Commit f916cd03 authored by Jonas Bernoulli's avatar Jonas Bernoulli

revert buffers using a globalized variant of auto-revert-mode

Replace the old magit-specific auto-revert implementation with the
mode `magit-auto-revert-mode', a globalized variant of the built-in
`auto-revert-mode'.  By default Magit still explicitly triggers the
reverts after running git for side-effects.  Automatic reverts are
still enabled by default, and Magit is less verbose about it.  The
behavior can be tuned using `magit-auto-revert-' and `auto-revert-'
options.

The main benefit of this change is that this implementation caches
whether a file is tracked or not.  The old implementation determined
this on every revert cycle, which did not perform well when there
were many open buffers and/or many tracked files.
parent 455c8f22
......@@ -19,6 +19,13 @@ UNRELEASED.
Changes since v2.3.0
--------------------
* The new mode `magit-auto-revert-mode', a magit-specific globalized
variant of `auto-revert-mode', replace the old implementation, which
was configured using the option `magit-revert-buffers'. The new
mode is enabled for all users by default, except for those who have
set `magit-revert-buffers' to nil while the old implementation was
still in use. #2474
* All of Git's push-related variables are now honored. #2414
* In addition to the upstream branch, the push-remote (configured
......@@ -87,17 +94,6 @@ Changes since v2.3.0
* The command `with-editor-finish' now runs the new hook
`with-editor-post-finish-hook'.
* By default all files inside a repository are now reverted when the
file on disk changes, not just tracked files, as was the case
before. This change was necessary because determining the tracked
files can be very slow depending on the number of tracked files and
buffers. Setting `magit-revert-buffers-only-for-tracked-files' to
`t' restores the old behavior. #2458
* It is now possible to revert file-visiting buffers both silently and
asynchronously at the same time (by setting `magit-revert-buffers' to
a negative number).
* The command `magit-diff-visit-file' now runs the new hook
`magit-diff-visit-file-hook'.
......
This diff is collapsed.
This diff is collapsed.
......@@ -87,7 +87,7 @@ test-interactive:
(ert t))"
magit: clean-lisp
@$(EMACSBIN) -Q $(LOAD_PATH) --eval "(progn\
@$(EMACSBIN) -Q $(LOAD_PATH) --debug-init --eval "(progn\
(require 'magit)\
(global-set-key \"\\C-xg\" 'magit-status)\
(tool-bar-mode 0)\
......
......@@ -30,6 +30,7 @@ ELS += magit-popup.el
ELS += magit-utils.el
ELS += magit-section.el
ELS += magit-git.el
ELS += magit-autorevert.el
ELS += magit-mode.el
ELS += magit-process.el
ELS += magit-core.el
......
......@@ -14,6 +14,7 @@ magit-mode.elc: magit-section.elc magit-git.elc
magit-popup.elc:
magit-process.elc: with-editor.elc magit-utils.elc magit-section.elc \
magit-git.elc magit-mode.elc
magit-autorevert.elc: magit-git.elc magit-process.elc
magit-core.elc: magit-utils.elc magit-section.elc magit-git.elc \
magit-mode.elc magit-popup.elc magit-process.elc
magit-diff.elc: git-commit.elc magit-core.elc
......
......@@ -176,7 +176,7 @@ The major mode configured here is turned on by the minor mode
"Hook run at the end of `git-commit-setup'."
:group 'git-commit
:type 'hook
:options '(magit-revert-buffers
:options '(
git-commit-save-message
git-commit-setup-changelog-support
git-commit-turn-on-auto-fill
......
......@@ -164,18 +164,17 @@ With a prefix argument and if necessary, attempt a 3-way merge."
"Add the change at point to the staging area."
(interactive)
(--when-let (magit-apply--get-selection)
(let ((inhibit-magit-revert t))
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (magit-stage-untracked))
(`(unstaged region) (magit-apply-region it "--cached"))
(`(unstaged hunk) (magit-apply-hunk it "--cached"))
(`(unstaged hunks) (magit-apply-hunks it "--cached"))
(`(unstaged file) (magit-stage-1 "-u" (list (magit-section-value it))))
(`(unstaged files) (magit-stage-1 "-u" (magit-region-values)))
(`(unstaged list) (magit-stage-1 "-u"))
(`(staged ,_) (user-error "Already staged"))
(`(committed ,_) (user-error "Cannot stage committed changes"))
(`(undefined ,_) (user-error "Cannot stage this change"))))))
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (magit-stage-untracked))
(`(unstaged region) (magit-apply-region it "--cached"))
(`(unstaged hunk) (magit-apply-hunk it "--cached"))
(`(unstaged hunks) (magit-apply-hunks it "--cached"))
(`(unstaged file) (magit-stage-1 "-u" (list (magit-section-value it))))
(`(unstaged files) (magit-stage-1 "-u" (magit-region-values)))
(`(unstaged list) (magit-stage-1 "-u"))
(`(staged ,_) (user-error "Already staged"))
(`(committed ,_) (user-error "Cannot stage committed changes"))
(`(undefined ,_) (user-error "Cannot stage this change")))))
;;;###autoload
(defun magit-stage-file (file)
......@@ -213,7 +212,9 @@ ignored) files.
(defun magit-stage-1 (arg &optional files)
(magit-wip-commit-before-change files " before stage")
(magit-run-git-no-revert "add" arg (if files (cons "--" files) "."))
(magit-run-git "add" arg (if files (cons "--" files) "."))
(when magit-auto-revert-mode
(mapc #'magit-turn-on-auto-revert-mode-if-desired files))
(magit-wip-commit-after-apply files " after stage"))
(defun magit-stage-untracked ()
......@@ -229,14 +230,15 @@ ignored) files.
(push file plain)))
(magit-wip-commit-before-change files " before stage")
(when plain
(magit-run-git-no-revert "add" "--" plain))
(magit-run-git "add" "--" plain)
(when magit-auto-revert-mode
(mapc #'magit-turn-on-auto-revert-mode-if-desired plain)))
(dolist (repo repos)
(let ((inhibit-magit-revert t))
(save-excursion
(goto-char (magit-section-start
(magit-get-section
`((file . ,repo) (untracked) (status)))))
(call-interactively 'magit-submodule-add))))
(save-excursion
(goto-char (magit-section-start
(magit-get-section
`((file . ,repo) (untracked) (status)))))
(call-interactively 'magit-submodule-add)))
(magit-wip-commit-after-apply files " after stage")))
;;;; Unstage
......@@ -245,20 +247,19 @@ ignored) files.
"Remove the change at point from the staging area."
(interactive)
(--when-let (magit-apply--get-selection)
(let ((inhibit-magit-revert t))
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (user-error "Cannot unstage untracked changes"))
(`(unstaged ,_) (user-error "Already unstaged"))
(`(staged region) (magit-apply-region it "--reverse" "--cached"))
(`(staged hunk) (magit-apply-hunk it "--reverse" "--cached"))
(`(staged hunks) (magit-apply-hunks it "--reverse" "--cached"))
(`(staged file) (magit-unstage-1 (list (magit-section-value it))))
(`(staged files) (magit-unstage-1 (magit-region-values)))
(`(staged list) (magit-unstage-all))
(`(committed ,_) (if (bound-and-true-p magit-unstage-use-anti-stage)
(magit-anti-stage)
(user-error "Cannot unstage committed changes")))
(`(undefined ,_) (user-error "Cannot unstage this change"))))))
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (user-error "Cannot unstage untracked changes"))
(`(unstaged ,_) (user-error "Already unstaged"))
(`(staged region) (magit-apply-region it "--reverse" "--cached"))
(`(staged hunk) (magit-apply-hunk it "--reverse" "--cached"))
(`(staged hunks) (magit-apply-hunks it "--reverse" "--cached"))
(`(staged file) (magit-unstage-1 (list (magit-section-value it))))
(`(staged files) (magit-unstage-1 (magit-region-values)))
(`(staged list) (magit-unstage-all))
(`(committed ,_) (if (bound-and-true-p magit-unstage-use-anti-stage)
(magit-anti-stage)
(user-error "Cannot unstage committed changes")))
(`(undefined ,_) (user-error "Cannot unstage this change")))))
;;;###autoload
(defun magit-unstage-file (file)
......
;;; magit-autorevert.el --- revert buffers when files in Git repositories change -*- lexical-binding: t -*-
;; Copyright (C) 2010-2016 The Magit Project Contributors
;;
;; You should have received a copy of the AUTHORS.md file which
;; lists all contributors. If not, see http://magit.vc/authors.
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; Magit is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; Magit is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
;; License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with Magit. If not, see http://www.gnu.org/licenses.
;;; Code:
(require 'cl-lib)
(require 'dash)
(require 'magit-git)
(require 'autorevert)
(defcustom magit-auto-revert-tracked-only t
"Whether `magit-auto-revert-mode' only reverts tracked files."
:package-version '(magit . "2.4.0")
:group 'magit
:type 'boolean
:set (lambda (var val)
(set var val)
(when (bound-and-true-p magit-auto-revert-mode)
(magit-auto-revert-mode -1)
(magit-auto-revert-mode))))
(defcustom magit-auto-revert-immediately (not file-notify--library)
"Whether Magit reverts buffers immediately.
If this is non-nil and either `global-auto-revert-mode' or
`magit-auto-revert-mode' is enabled, then Magit immediately
reverts buffers by explicitly calling `auto-revert-buffers'
after running git for side-effects.
If `auto-revert-use-notify' is non-nil (and file notifications
are actually supported), then `magit-auto-revert-immediately'
should be nil, because the reverts happen immediately anyway.
If `magit-auto-revert-immediately' and `auto-revert-use-notify'
are both nil, then reverts happen after `auto-revert-interval'
seconds of user inactivity. That is not desirable."
:package-version '(magit . "2.4.0")
:group 'magit
:type 'boolean)
(defun magit-turn-on-auto-revert-mode-if-desired (&optional file)
(if file
(--when-let (find-buffer-visiting file)
(with-current-buffer it
(magit-turn-on-auto-revert-mode-if-desired)))
(when (and buffer-file-name
(magit-toplevel)
(or (not magit-auto-revert-tracked-only)
(magit-file-tracked-p buffer-file-name)))
(auto-revert-mode))))
(defvar magit-revert-buffers t)
(make-obsolete-variable 'magit-revert-buffers 'magit-auto-revert-mode
"Magit 2.4.0")
;;;###autoload
(define-globalized-minor-mode magit-auto-revert-mode auto-revert-mode
magit-turn-on-auto-revert-mode-if-desired
:package-version '(magit . "2.4.0")
:group 'magit
;; When `global-auto-revert-mode' is enabled, then this mode is
;; redundant. When `magit-revert-buffers' is nil, then the user has
;; opted out of the automatic reverts while the old implementation
;; was still in use. In all other cases enable the mode because if
;; buffers are not automatically reverted that would make many very
;; common tasks much more cumbersome.
:init-value (and (not global-auto-revert-mode) magit-revert-buffers))
;; `:init-value t' only sets the value of the mode variable
;; but does not cause the mode function to be called.
(cl-eval-when (load eval)
(when magit-auto-revert-mode
(magit-auto-revert-mode)))
;; If the user has set the obsolete `magit-revert-buffers' to nil
;; after loading magit, then we should still respect that setting.
(defun magit-auto-revert-mode--maybe-turn-off-after-init ()
(unless magit-revert-buffers
(magit-auto-revert-mode -1)))
(unless after-init-time
(add-hook 'after-init-hook
#'magit-auto-revert-mode--maybe-turn-off-after-init t))
(put 'magit-auto-revert-mode 'function-documentation
"Toggle Magit Auto Revert mode.
With a prefix argument ARG, enable Magit Auto Revert mode if ARG
is positive, and disable it otherwise. If called from Lisp,
enable the mode if ARG is omitted or nil.
Magit Auto Revert mode is a global minor mode that reverts
buffers associated with a file that is located inside a Git
repository when the file changes on disk. Use `auto-revert-mode'
to revert a particular buffer. Or use `global-auto-revert-mode'
to revert all file-visiting buffers, not just those that visit
a file located inside a Git repository.
This global mode works by turning on the buffer-local mode
`auto-revert-mode' at the time a buffer is first created. The
local mode is turned on if the visited file is being tracked in
a Git repository at the time when the buffer is created.
If `magit-auto-revert-tracked-only' is non-nil (the default),
then only tracked files are reverted. But if you stage a
previously untracked file using `magit-stage', then this mode
notices that.
Unlike `global-auto-revert-mode', this mode never reverts any
buffers that are not visiting files.
This function calls the hook `magit-auto-revert-mode-hook'.")
(defun magit-auto-revert-buffers ()
(when (and magit-auto-revert-immediately
(or magit-auto-revert-mode global-auto-revert-mode))
(auto-revert-buffers)))
(custom-add-to-group 'magit 'auto-revert-check-vc-info 'custom-variable)
;;; magit-autorevert.el ends soon
(provide 'magit-autorevert)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; magit-autorevert.el ends here
......@@ -36,6 +36,7 @@
(require 'magit-mode)
(require 'magit-popup)
(require 'magit-process)
(require 'magit-autorevert)
(defgroup magit nil
"Controlling Git from Emacs."
......
This diff is collapsed.
......@@ -262,30 +262,12 @@ before use.
After Git returns, the current buffer (if it is a Magit buffer)
as well as the current repository's status buffer are refreshed.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if `magit-revert-buffers' is non-nil.
Process output goes into a new section in the buffer returned by
`magit-process-buffer'."
(magit-call-git args)
(magit-refresh))
(defun magit-run-git-no-revert (&rest args)
"Call Git synchronously in a separate process, and refresh.
Option `magit-git-executable' specifies the Git executable and
option `magit-git-global-arguments' specifies constant arguments.
The arguments ARGS specify arguments to Git, they are flattened
before use.
After Git returns, the current buffer (if it is a Magit buffer)
as well as the current repository's status buffer are refreshed.
Process output goes into a new section in the buffer returned by
`magit-process-buffer'."
(let ((inhibit-magit-revert t))
(magit-run-git args)))
(defvar magit-pre-call-git-hook nil)
(defun magit-call-git (&rest args)
......@@ -345,8 +327,6 @@ flattened before use.
After Git returns, the current buffer (if it is a Magit buffer)
as well as the current repository's status buffer are refreshed.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if `magit-revert-buffers' is non-nil.
When INPUT is nil then do not refresh any buffers.
This function actually starts a asynchronous process, but it then
......@@ -379,8 +359,6 @@ Display the command line arguments in the echo area.
After Git returns some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer
and still alive), as well as the respective Magit status buffer.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if `magit-revert-buffers' is non-nil.
See `magit-start-process' for more information."
(message "Running %s %s" magit-git-executable
......@@ -389,20 +367,6 @@ See `magit-start-process' for more information."
m))
(magit-start-git nil args))
(defun magit-run-git-async-no-revert (&rest args)
"Start Git, prepare for refresh, and return the process object.
ARGS is flattened and then used as arguments to Git.
Display the command line arguments in the echo area.
After Git returns some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer
and still alive), as well as the respective Magit status buffer.
See `magit-start-process' for more information."
(let ((inhibit-magit-revert t))
(magit-run-git-async args)))
(defun magit-run-git-with-editor (&rest args)
"Export GIT_EDITOR and start Git.
Also prepare for refresh and return the process object.
......@@ -416,8 +380,7 @@ and still alive), as well as the respective Magit status buffer.
See `magit-start-process' and `with-editor' for more information."
(with-editor "GIT_EDITOR"
(let ((magit-process-popup-time -1)
(inhibit-magit-revert nil))
(let ((magit-process-popup-time -1))
(magit-run-git-async args))))
(defun magit-run-git-sequencer (&rest args)
......@@ -433,9 +396,6 @@ and still alive), as well as the respective Magit status buffer.
If the sequence stops at a commit, make the section representing
that commit the current section by moving `point' there.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if `magit-revert-buffers' is non-nil.
See `magit-start-process' and `with-editor' for more information."
(with-editor "GIT_EDITOR"
(let ((magit-process-popup-time -1))
......@@ -460,8 +420,6 @@ flattened before use.
After Git returns some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer
and still alive), as well as the respective Magit status buffer.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if `magit-revert-buffers' is non-nil.
See `magit-start-process' for more information."
(run-hooks 'magit-pre-start-git-hook)
......@@ -485,9 +443,7 @@ the sentinel and filter.
After the process returns, `magit-process-sentinel' refreshes the
buffer that was current when `magit-start-process' was called (if
it is a Magit buffer and still alive), as well as the respective
Magit status buffer. Unmodified buffers visiting files that are
tracked in the current repository are reverted if
`magit-revert-buffers' is non-nil."
Magit status buffer."
(-let* (((process-buf . section)
(magit-process-setup program args))
(process
......@@ -508,8 +464,6 @@ tracked in the current repository are reverted if
(process-put process 'default-dir default-directory)
(when inhibit-magit-refresh
(process-put process 'inhibit-refresh t))
(when inhibit-magit-revert
(process-put process 'inhibit-revert t))
(setf (magit-section-process section) process)
(with-current-buffer process-buf
(set-marker (process-mark process) (point)))
......@@ -592,8 +546,7 @@ tracked in the current repository are reverted if
(when (eq process magit-this-process)
(setq magit-this-process nil))
(unless (process-get process 'inhibit-refresh)
(let ((inhibit-magit-revert (process-get process 'inhibit-revert))
(command-buf (process-get process 'command-buf)))
(let ((command-buf (process-get process 'command-buf)))
(if (buffer-live-p command-buf)
(with-current-buffer command-buf
(magit-refresh))
......
......@@ -159,7 +159,7 @@ the variable isn't already set."
(defun magit-git-fetch (remote args)
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "fetch" remote args))
(magit-run-git-async "fetch" remote args))
;;;###autoload
(defun magit-fetch-from-pushremote (args)
......@@ -193,7 +193,7 @@ the variable isn't already set."
"Fetch from all remotes."
(interactive (list (magit-fetch-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "remote" "update" args))
(magit-run-git-async "remote" "update" args))
;;;###autoload
(defun magit-fetch-all-prune ()
......@@ -202,14 +202,14 @@ Prune remote tracking branches for branches that have been
removed on the respective remote."
(interactive)
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "remote" "update" "--prune"))
(magit-run-git-async "remote" "update" "--prune"))
;;;###autoload
(defun magit-fetch-all-no-prune ()
"Fetch from all remotes."
(interactive)
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "remote" "update"))
(magit-run-git-async "remote" "update"))
;;; Pull
......@@ -381,9 +381,8 @@ removed after restarting Emacs."
(run-hooks 'magit-credential-hook)
(-let [(remote . target)
(magit-split-branch-name target)]
(magit-run-git-async-no-revert "push" "-v" args remote
(format "%s:refs/heads/%s"
branch target))))
(magit-run-git-async "push" "-v" args remote
(format "%s:refs/heads/%s" branch target))))
;;;###autoload
(defun magit-push-current-to-pushremote (args &optional push-remote)
......@@ -491,7 +490,7 @@ If just one exists, use that without requiring confirmation."
(interactive (list (magit-read-remote "Push matching branches to" nil t)
(magit-push-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" "-v" args remote ":"))
(magit-run-git-async "push" "-v" args remote ":"))
;;;###autoload
(defun magit-push-tags (remote &optional args)
......@@ -502,7 +501,7 @@ branch as default."
(interactive (list (magit-read-remote "Push tags to remote" nil t)
(magit-push-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" remote "--tags" args))
(magit-run-git-async "push" remote "--tags" args))
;;;###autoload
(defun magit-push-tag (tag remote &optional args)
......@@ -512,7 +511,7 @@ branch as default."
(list tag (magit-read-remote (format "Push %s to remote" tag) nil t)
(magit-push-arguments))))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" remote tag args))
(magit-run-git-async "push" remote tag args))
;;;###autoload
(defun magit-push-implicitly (args)
......@@ -537,7 +536,7 @@ what this command will do, the value it returns is displayed in
the popup buffer."
(interactive (list (magit-push-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" "-v" args))
(magit-run-git-async "push" "-v" args))
(defun magit-push-implicitly--desc ()
(let ((default (magit-get "push.default")))
......@@ -587,7 +586,7 @@ To add this command to the push popup add this to your init file:
(interactive (list (magit-read-remote "Push to remote")
(magit-push-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" "-v" args remote))
(magit-run-git-async "push" "-v" args remote))
(defun magit-push-to-remote--desc ()
(format "using %s\n" (propertize "git push <remote>" 'face 'bold)))
......@@ -631,7 +630,7 @@ HEAD but not from the specified commit)."
range
(format "%s~..%s" range range))))
(magit-patch-arguments)))
(magit-run-git-no-revert "format-patch" range args))
(magit-run-git "format-patch" range args))
;;;###autoload
(defun magit-request-pull (url start end)
......@@ -650,8 +649,7 @@ is asked to pull. START has to be reachable from that commit."
(compose-mail)
(setq default-directory dir))
(message-goto-body)
(let ((inhibit-magit-revert t))
(magit-git-insert "request-pull" start url end))
(magit-git-insert "request-pull" start url end)
(set-buffer-modified-p nil))
;;; magit-remote.el ends soon
......
......@@ -1496,7 +1496,7 @@ With prefix, forces the rename even if NEW already exists.
(magit-read-string-ns (format "Rename branch '%s' to" branch))
current-prefix-arg)))
(unless (string= old new)
(magit-run-git-no-revert "branch" (if force "-M" "-m") old new)))
(magit-run-git "branch" (if force "-M" "-m") old new)))
;;;;; Branch Variables
......@@ -1564,8 +1564,7 @@ already set. When nil, then always unset."
(concat "refs/heads/" merge)))
(magit-call-git "branch" "--unset-upstream" branch))
(when (called-interactively-p 'any)
(let ((inhibit-magit-revert t))
(magit-refresh))))
(magit-refresh)))
(defun magit-format-branch*merge/remote ()
(let* ((branch (or (magit-get-current-branch) "<name>"))
......@@ -2054,7 +2053,7 @@ defaulting to the tag at point.
(interactive (list (--if-let (magit-region-values 'tag)
(magit-confirm t nil "Delete %i tags" it)
(magit-read-tag "Delete tag" t))))
(magit-run-git-no-revert "tag" "-d" tags))
(magit-run-git "tag" "-d" tags))
(defun magit-tag-prune (tags remote-tags remote)
"Offer to delete tags missing locally from REMOTE, and vice versa."
......@@ -2078,8 +2077,7 @@ defaulting to the tag at point.
(when tags
(magit-call-git "tag" "-d" tags))
(when remote-tags
(magit-run-git-async-no-revert
"push" remote (--map (concat ":" it) remote-tags))))
(magit-run-git-async "push" remote (--map (concat ":" it) remote-tags))))
;;;; Notes
......@@ -2179,12 +2177,12 @@ of Git's `note' command, default to operate on that ref."
it)))
current-prefix-arg))
(if ref
(magit-run-git-no-revert "config" (and global "--global") "core.notesRef"
(if (string-prefix-p "refs/" ref)
ref
(concat "refs/notes/" ref)))
(magit-run-git-no-revert "config" (and global "--global")
"--unset" "core.notesRef")))
(magit-run-git "config" (and global "--global") "core.notesRef"
(if (string-prefix-p "refs/" ref)
ref
(concat "refs/notes/" ref)))
(magit-run-git "config" (and global "--global")
"--unset" "core.notesRef")))
(defun magit-notes-set-display-refs (refs &optional global)
"Set notes refs to be display in addition to \"core.notesRef\".
......@@ -2208,8 +2206,7 @@ the current repository."
(magit-git-success "config" "--unset-all" global "notes.displayRef")
(dolist (ref refs)
(magit-call-git "config" "--add" global "notes.displayRef" ref))
(let ((inhibit-magit-revert t))
(magit-refresh)))
(magit-refresh))
(defun magit-notes-read-args (prompt)
(list (magit-read-branch-or-commit prompt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment