summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-06 11:47:57 +0800
committerGitHub <[email protected]>2023-01-06 11:47:57 +0800
commit59e2cfba89e79d1373f11d38262ff23db33679bb (patch)
treeb65c48ef8f911a7795660c5ba5845ff3b85bd324
parent964c5096ff9d4fdfd96417eeb3704f3117b26503 (diff)
parent860094bc978c2ca509a21a85ffdbce7173ba8aad (diff)
Merge pull request #3250 from xmake-io/package
select correct default branch for package
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua11
-rw-r--r--xmake/modules/private/action/require/impl/package.lua2
2 files changed, 10 insertions, 3 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index 63dc57ba9..f6070021d 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -85,10 +85,17 @@ function _checkout(package, url, sourcedir, url_alias)
-- download package from branches?
packagedir = path.join(sourcedir .. ".tmp", package:name())
- if package:branch() then
+ local branch = package:branch()
+ if branch then
+
+ -- we need select the correct default branch
+ -- @see https://github.com/xmake-io/xmake/issues/3248
+ if branch == "@default" then
+ branch = nil
+ end
-- only shadow clone this branch
- git.clone(url, {depth = 1, recursive = true, longpaths = longpaths, branch = package:branch(), outputdir = packagedir})
+ git.clone(url, {depth = 1, recursive = true, longpaths = longpaths, branch = branch, outputdir = packagedir})
-- download package from revision or tag?
else
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 0061034df..2d2c8447f 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -367,7 +367,7 @@ function _select_package_version(package, requireinfo, locked_requireinfo)
if require_version and #require_version == 40 and require_version:match("%w+") then
version, source = require_version, "commit"
else
- version, source = require_version ~= "latest" and require_version or "master", "branch"
+ version, source = require_version ~= "latest" and require_version or "@default", "branch"
end
end
-- local source package? we use a phony version