aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/RelNotes/3.4.0.org4
-rw-r--r--lisp/magit-clone.el15
2 files changed, 19 insertions, 0 deletions
diff --git a/docs/RelNotes/3.4.0.org b/docs/RelNotes/3.4.0.org
index 86fa3c3..a46e266 100644
--- a/docs/RelNotes/3.4.0.org
+++ b/docs/RelNotes/3.4.0.org
@@ -20,6 +20,10 @@
repository and then immediately enable a sparse checkout, avoiding a
checkout of the full working tree. #4102
+- The ~magit-clone~ transient now includes ~--filter~ (hidden by
+ default) to support partial cloning, a feature that is available as
+ of Git v2.17. #4102
+
** Fixes since v3.3.0
- Automatic saving of file-visiting buffers was broken inside remote
diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el
index 91e06ce..8f5e910 100644
--- a/lisp/magit-clone.el
+++ b/lisp/magit-clone.el
@@ -117,6 +117,9 @@ the name of the owner. Also see `magit-clone-name-alist'."
["Setup arguments"
("-o" "Set name of remote" ("-o" "--origin="))
("-b" "Set HEAD branch" ("-b" "--branch="))
+ (magit-clone:--filter
+ :if (lambda () (magit-git-version>= "2.17.0"))
+ :level 7)
("-g" "Separate git directory" "--separate-git-dir="
transient-read-directory :level 7)
("-t" "Use template directory" "--template="
@@ -139,6 +142,18 @@ the name of the owner. Also see `magit-clone-name-alist'."
(transient-setup #'magit-clone)
(call-interactively #'magit-clone-regular)))
+(transient-define-argument magit-clone:--filter ()
+ :description "Filter some objects"
+ :class 'transient-option
+ :key "-f"
+ :argument "--filter="
+ :reader 'magit-clone-read-filter)
+
+(defun magit-clone-read-filter (prompt initial-input history)
+ (magit-completing-read prompt
+ (list "blob:none" "tree:0")
+ nil nil initial-input history))
+
;;;###autoload
(defun magit-clone-regular (repository directory args)
"Create a clone of REPOSITORY in DIRECTORY.