emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit ae3770306d 3/7: magit-sparse-checkout: Add --sp


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit ae3770306d 3/7: magit-sparse-checkout: Add --sparse-index
Date: Sun, 23 Jan 2022 16:58:07 -0500 (EST)

branch: elpa/git-commit
commit ae3770306d091f45bf8a9183494bc42540cc4d70
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    magit-sparse-checkout: Add --sparse-index
    
    If `git sparse-checkout init' is called with --sparse-index, the index
    is written with sparse directory entries.
    
    Note that the user can also get this behavior by configuring
    index.sparse to true, in which case --no-sparse-index would be the
    useful argument to have in the transient so that the caller could
    override their configured value for a particular call.
    
    However, leave off --no-sparse-index, at least for now.  There are
    other examples of --x/--no-x options along with an associated config
    knob (e.g., --recurse-submodules in magit-branch) that we don't bother
    supporting (in terms of having both options available in the transient
    or considering the configured value).
---
 lisp/magit-sparse-checkout.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/magit-sparse-checkout.el b/lisp/magit-sparse-checkout.el
index fea2743d43..f029756f54 100644
--- a/lisp/magit-sparse-checkout.el
+++ b/lisp/magit-sparse-checkout.el
@@ -76,6 +76,9 @@ See the `git sparse-checkout' manpage for details about
 (transient-define-prefix magit-sparse-checkout ()
   "Create and manage sparse checkouts."
   :man-page "git-sparse-checkout"
+  ["Arguments for enabling"
+   :if-not magit-sparse-checkout-enabled-p
+   ("-i" "Use sparse index" "--sparse-index")]
   ["Actions"
    [:if-not magit-sparse-checkout-enabled-p
     ("e" "Enable sparse checkout" magit-sparse-checkout-enable)]
@@ -86,11 +89,11 @@ See the `git sparse-checkout' manpage for details about
     ("a" "Add directories" magit-sparse-checkout-add)]])
 
 ;;;###autoload
-(defun magit-sparse-checkout-enable ()
+(defun magit-sparse-checkout-enable (&optional args)
   "Convert the working tree to a sparse checkout."
-  (interactive)
+  (interactive (list (transient-args 'magit-sparse-checkout)))
   (magit-sparse-checkout--assert-version)
-  (magit-run-git-async "sparse-checkout" "init" "--cone"))
+  (magit-run-git-async "sparse-checkout" "init" "--cone" args))
 
 ;;;###autoload
 (defun magit-sparse-checkout-set (directories)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]