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/checkout.lua | |
| parent | 2d4595d2d0ac368f4606e30ad31489f6be8454d6 (diff) | |
add git support
Diffstat (limited to 'xmake/modules/devel/git/checkout.lua')
| -rw-r--r-- | xmake/modules/devel/git/checkout.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/modules/devel/git/checkout.lua b/xmake/modules/devel/git/checkout.lua index 6c7645d52..dfbfeb423 100644 --- a/xmake/modules/devel/git/checkout.lua +++ b/xmake/modules/devel/git/checkout.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.semver") +import("devel.git.support") import("lib.detect.find_tool") -- checkout to given branch, tag or commit @@ -39,7 +40,7 @@ import("lib.detect.find_tool") -- function main(commit, opt) opt = opt or {} - local git = assert(find_tool("git", {version = true}), "git not found!") + local git = assert(find_tool("git"), "git not found!") local argv = {} if opt.fsmonitor then table.insert(argv, "-c") @@ -51,7 +52,7 @@ function main(commit, opt) -- @see https://github.com/xmake-io/xmake/issues/6071 -- https://github.blog/open-source/git/bring-your-monorepo-down-to-size-with-sparse-checkout/ - if opt.includes and git.version and semver.compare(git.version, "2.25") >= 0 then + if opt.includes and support.can_sparse_checkout() then os.vrunv(git.program, {"sparse-checkout", "init", "--cone"}, {curdir = opt.repodir}) os.vrunv(git.program, table.join({"sparse-checkout", "set"}, opt.includes), {curdir = opt.repodir}) end |
