Skip to content

Commit 7003c61

Browse files
committed
improve treeless for git.clone
1 parent 5aeee42 commit 7003c61

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

xmake/modules/devel/git/clone.lua

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ function main(url, opt)
9393
table.insert(argv, "--filter=tree:0")
9494
end
9595

96+
-- no checkout
97+
if opt.checkout == false then
98+
table.insert(argv, "--no-checkout")
99+
end
100+
96101
-- recursive?
97102
if opt.recursive then
98103
table.insert(argv, "--recursive")

xmake/modules/private/action/require/impl/actions/download.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ function _checkout(package, url, sourcedir, opt)
121121
else
122122

123123
-- clone whole history and tags
124-
git.clone(url, {longpaths = longpaths, outputdir = packagedir})
124+
-- @see https://github.com/xmake-io/xmake/issues/5507
125+
git.clone(url, {treeless = true, checkout = false, longpaths = longpaths, outputdir = packagedir})
125126

126127
-- attempt to checkout the given version
127128
git.checkout(revision, {repodir = packagedir})

xmake/modules/private/action/require/impl/actions/download_resources.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function _checkout(package, resource_name, resource_url, resource_revision)
7272
local longpaths = package:policy("platform.longpaths")
7373

7474
-- clone whole history and tags
75-
git.clone(resource_url, {longpaths = longpaths, outputdir = resourcedir})
75+
git.clone(resource_url, {treeless = true, checkout = false, longpaths = longpaths, outputdir = resourcedir})
7676

7777
-- attempt to checkout the given version
7878
git.checkout(resource_revision, {repodir = resourcedir})

xmake/modules/private/action/require/impl/repository.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function _get_packagedir_from_locked_repo(packagename, locked_repo)
6060
local lastcommit
6161
if not os.isdir(repodir_local) then
6262
if repo_global then
63-
git.clone(repo_global:directory(), {verbose = option.get("verbose"), outputdir = repodir_local, autocrlf = false})
63+
git.clone(repo_global:directory(), {treeless = true, checkout = false, verbose = option.get("verbose"), outputdir = repodir_local, autocrlf = false})
6464
lastcommit = repo_global:commit()
6565
elseif network ~= "private" then
6666
local remoteurl = proxy.mirror(locked_repo.url) or locked_repo.url

0 commit comments

Comments
 (0)