summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/clone.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-08-31 00:40:56 +0800
committerruki <[email protected]>2023-08-31 00:40:56 +0800
commit39afcd4821aab51f2eaacdb163c87e9d55e2a4c7 (patch)
tree4ae03ffd055175f0c2b52c2bce2339510e1cf498 /xmake/modules/devel/git/clone.lua
parent2db1266629941c424b9a758221e8293e09fb7f32 (diff)
improve to clone tag #4151
Diffstat (limited to 'xmake/modules/devel/git/clone.lua')
-rw-r--r--xmake/modules/devel/git/clone.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua
index 58f43462d..469d36c2e 100644
--- a/xmake/modules/devel/git/clone.lua
+++ b/xmake/modules/devel/git/clone.lua
@@ -20,9 +20,24 @@
-- imports
import("core.base.option")
+import("core.base.semver")
import("lib.detect.find_tool")
import("net.proxy")
+-- can clone tag?
+-- @see https://github.com/xmake-io/xmake/issues/4151
+function can_clone_tag()
+ local can = _g.can_clone_tag
+ if can == nil then
+ local git = assert(find_tool("git", {version = true}), "git not found!")
+ if git.version and semver.compare(git.version, "1.7.10") >= 0 then
+ can = true
+ end
+ _g.can_clone_tag = can or false
+ end
+ return can or false
+end
+
-- clone url
--
-- @param url the git url