summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-26 20:36:52 +0800
committerGitHub <[email protected]>2024-08-26 20:36:52 +0800
commit559827c1e47bbaf25eb41657e3da7ec9c4316ee2 (patch)
treee324cdaa807eea75ee1214d941232a285aa4edd5
parentc80898e12f88abe7df463bc64e0fb6bf081b8cdf (diff)
parent818b23b778edb642bf15e18ab4b52eb1a07fb329 (diff)
Merge pull request #5509 from xmake-io/treeless
use treeless instead of depth1
-rw-r--r--xmake/actions/update/main.lua2
-rw-r--r--xmake/modules/devel/git/clone.lua8
-rw-r--r--xmake/modules/package/manager/conan/v1/install_package.lua2
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua4
-rw-r--r--xmake/modules/private/utils/statistics.lua2
5 files changed, 12 insertions, 6 deletions
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua
index f97df2291..7553878b2 100644
--- a/xmake/actions/update/main.lua
+++ b/xmake/actions/update/main.lua
@@ -484,7 +484,7 @@ function main()
http.download(url, installerfile)
end
else
- git.clone(url, {depth = 1, recurse_submodules = not script_only, branch = version, outputdir = sourcedir})
+ git.clone(url, {treeless = true, recurse_submodules = not script_only, branch = version, outputdir = sourcedir})
end
return true
end,
diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua
index bdd02caf1..cc0b8f841 100644
--- a/xmake/modules/devel/git/clone.lua
+++ b/xmake/modules/devel/git/clone.lua
@@ -62,7 +62,7 @@ end
-- import("devel.git")
--
-- git.clone("[email protected]:xmake-io/xmake.git")
--- git.clone("[email protected]:xmake-io/xmake.git", {depth = 1, branch = "master", outputdir = "/tmp/xmake", longpaths = true})
+-- git.clone("[email protected]:xmake-io/xmake.git", {depth = 1, treeless = true, branch = "master", outputdir = "/tmp/xmake", longpaths = true})
--
-- @endcode
--
@@ -87,6 +87,12 @@ function main(url, opt)
table.insert(argv, type(opt.depth) == "number" and tostring(opt.depth) or opt.depth)
end
+ -- treeless?
+ -- @see https://github.com/xmake-io/xmake/issues/5507
+ if opt.treeless then
+ table.insert(argv, "--filter=tree:0")
+ end
+
-- recursive?
if opt.recursive then
table.insert(argv, "--recursive")
diff --git a/xmake/modules/package/manager/conan/v1/install_package.lua b/xmake/modules/package/manager/conan/v1/install_package.lua
index 3475a21b3..044cb18d1 100644
--- a/xmake/modules/package/manager/conan/v1/install_package.lua
+++ b/xmake/modules/package/manager/conan/v1/install_package.lua
@@ -109,7 +109,7 @@ function _conan_install_xmake_generator(conan)
-- clone xmake generator repository
local ok = false
for _, url in ipairs(mainurls) do
- ok = try { function () git.clone(url, {depth = 1, branch = "0.1.0/testing", outputdir = xmake_generator_localdir}); return true end }
+ ok = try { function () git.clone(url, {treeless = true, branch = "0.1.0/testing", outputdir = xmake_generator_localdir}); return true end }
if ok then
break
end
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index fc3045aa2..77bd4c55b 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -96,7 +96,7 @@ function _checkout(package, url, sourcedir, opt)
end
-- only shallow clone this branch
- git.clone(url, {depth = 1, recursive = true, shallow_submodules = true, longpaths = longpaths, branch = branch, outputdir = packagedir})
+ git.clone(url, {treeless = true, recursive = true, shallow_submodules = true, longpaths = longpaths, branch = branch, outputdir = packagedir})
-- download package from revision or tag?
else
@@ -117,7 +117,7 @@ function _checkout(package, url, sourcedir, opt)
-- only shallow clone this tag
-- @see https://github.com/xmake-io/xmake/issues/4151
if tag and git.clone.can_clone_tag() then
- git.clone(url, {depth = 1, recursive = true, shallow_submodules = true, longpaths = longpaths, branch = tag, outputdir = packagedir})
+ git.clone(url, {treeless = true, recursive = true, shallow_submodules = true, longpaths = longpaths, branch = tag, outputdir = packagedir})
else
-- clone whole history and tags
diff --git a/xmake/modules/private/utils/statistics.lua b/xmake/modules/private/utils/statistics.lua
index 6ebe20c13..8273d7af2 100644
--- a/xmake/modules/private/utils/statistics.lua
+++ b/xmake/modules/private/utils/statistics.lua
@@ -121,7 +121,7 @@ function main()
{
function ()
import("devel.git.clone")
- clone("https://github.com/xmake-io/xmake-stats.git", {depth = 1, branch = "master", outputdir = outputdir})
+ clone("https://github.com/xmake-io/xmake-stats.git", {treeless = true, branch = "master", outputdir = outputdir})
print("post to traffic ok!")
end
}