summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/clone.lua
diff options
context:
space:
mode:
authorstay <[email protected]>2025-03-26 16:20:50 +0800
committerstay <[email protected]>2025-04-06 08:46:19 +0800
commitcd6ace825c1401c7a17929fea56c7771dfc807ba (patch)
treecef16ea8ebea211141760419a7005edb4e301e2d /xmake/modules/devel/git/clone.lua
parent287680540de502ef8c8415923bf71b4009ae7c76 (diff)
add git.can_treeless()
Diffstat (limited to 'xmake/modules/devel/git/clone.lua')
-rw-r--r--xmake/modules/devel/git/clone.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua
index 27e8e49b1..018e6fcef 100644
--- a/xmake/modules/devel/git/clone.lua
+++ b/xmake/modules/devel/git/clone.lua
@@ -52,6 +52,20 @@ function can_shallow_submodules()
return can or false
end
+-- can clone with --filter=tree:0?
+-- @see https://github.com/xmake-io/xmake/issues/6246
+function can_treeless()
+ local can = _g.can_treeless
+ if can == nil then
+ local git = assert(find_tool("git", {version = true}), "git not found!")
+ if git.version and semver.compare(git.version, "2.16.0") >= 0 then
+ can = true
+ end
+ _g.can_treeless = can or false
+ end
+ return can or false
+end
+
-- clone url
--
-- @param url the git url