From 39afcd4821aab51f2eaacdb163c87e9d55e2a4c7 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 31 Aug 2023 00:40:56 +0800 Subject: improve to clone tag #4151 --- xmake/modules/devel/git/clone.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xmake/modules/devel/git/clone.lua') 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 -- cgit v1.3.1