diff options
| author | ruki <[email protected]> | 2025-11-11 00:28:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-11 00:28:24 +0800 |
| commit | a1637d473f01b372ea2dd1e038036ee756714fcb (patch) | |
| tree | d3275717f173a16568d038b532b7bf9b41bc3f02 /xmake/modules/devel/git/clone.lua | |
| parent | 2d4595d2d0ac368f4606e30ad31489f6be8454d6 (diff) | |
add git support
Diffstat (limited to 'xmake/modules/devel/git/clone.lua')
| -rw-r--r-- | xmake/modules/devel/git/clone.lua | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua index 2d2f0eb26..ceb5282b6 100644 --- a/xmake/modules/devel/git/clone.lua +++ b/xmake/modules/devel/git/clone.lua @@ -23,48 +23,7 @@ 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 - --- can clone with --shallow-submodules? --- @see https://github.com/xmake-io/xmake/issues/4151 -function can_shallow_submodules() - local can = _g.can_shallow_submodules - if can == nil then - local git = assert(find_tool("git", {version = true}), "git not found!") - if git.version and semver.compare(git.version, "2.9.0") >= 0 then - can = true - end - _g.can_shallow_submodules = can or false - end - 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 +import("devel.git.support") -- clone url -- @@ -103,7 +62,7 @@ function main(url, opt) -- treeless? -- @see https://github.com/xmake-io/xmake/issues/5507 - if opt.treeless and can_treeless() then + if opt.treeless and support.can_treeless() then table.insert(argv, "--filter=tree:0") end @@ -121,7 +80,7 @@ function main(url, opt) if opt.recurse_submodules then table.insert(argv, "--recurse-submodules") end - if opt.shallow_submodules and can_shallow_submodules() then + if opt.shallow_submodules and support.can_shallow_submodules() then table.insert(argv, "--shallow-submodules") end |
