[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 04ae81b563 1/2: magit--git-variable: Support us
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 04ae81b563 1/2: magit--git-variable: Support using global value |
Date: |
Sun, 27 Feb 2022 08:58:09 -0500 (EST) |
branch: elpa/git-commit
commit 04ae81b563766e7804745676c6698081e31ea6a0
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit--git-variable: Support using global value
---
lisp/magit-transient.el | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lisp/magit-transient.el b/lisp/magit-transient.el
index 8d6d582fe6..03e906d1a8 100644
--- a/lisp/magit-transient.el
+++ b/lisp/magit-transient.el
@@ -39,7 +39,8 @@
;;; Classes
(defclass magit--git-variable (transient-variable)
- ((scope :initarg :scope)))
+ ((scope :initarg :scope)
+ (global :initarg :global :initform nil)))
(defclass magit--git-variable:choices (magit--git-variable)
((choices :initarg :choices)
@@ -61,13 +62,14 @@
(cl-defmethod transient-init-value ((obj magit--git-variable))
(let ((variable (format (oref obj variable)
- (oref obj scope))))
+ (oref obj scope)))
+ (arg (if (oref obj global) "--global" "--local")))
(oset obj variable variable)
(oset obj value
(cond ((oref obj multi-value)
- (magit-get-all variable))
+ (magit-get-all arg variable))
(t
- (magit-git-string "config" "--local" variable))))))
+ (magit-get arg variable))))))
;;;; Read
@@ -108,11 +110,12 @@
;;;; Set
(cl-defmethod transient-infix-set ((obj magit--git-variable) value)
- (let ((variable (oref obj variable)))
+ (let ((variable (oref obj variable))
+ (arg (if (oref obj global) "--global" "--local")))
(oset obj value value)
(if (oref obj multi-value)
- (magit-set-all value variable)
- (magit-set value variable))
+ (magit-set-all value arg variable)
+ (magit-set value arg variable))
(magit-refresh)
(unless (or value transient--prefix)
(message "Unset %s" variable))))