summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-11-10 23:48:39 +0800
committerruki <[email protected]>2022-11-10 23:48:39 +0800
commitb3bec1b2ff0c27986c56f4b92f4d5e06b53c9ee1 (patch)
treef77fe266ec758db89b1e0a0c6562aa7814a6d653
parente893ca8f313b7f267e0d9189fdea457e65405ba1 (diff)
fix requires-lock
-rw-r--r--xmake/modules/private/action/require/impl/repository.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/xmake/modules/private/action/require/impl/repository.lua b/xmake/modules/private/action/require/impl/repository.lua
index 5ead9d6fc..b57f8dfe4 100644
--- a/xmake/modules/private/action/require/impl/repository.lua
+++ b/xmake/modules/private/action/require/impl/repository.lua
@@ -65,13 +65,14 @@ function _get_packagedir_from_locked_repo(packagename, locked_repo)
end
-- lock commit
+ local ok
if locked_repo.commit and os.isdir(path.join(repodir_local, ".git")) then
lastcommit = lastcommit or try {function()
return git.lastcommit({repodir = repodir_local})
end}
if locked_repo.commit ~= lastcommit then
-- try checkout to the given commit
- local ok = try {function () git.checkout(locked_repo.commit, {verbose = option.get("verbose"), repodir = repodir_local}); return true end}
+ ok = try {function () git.checkout(locked_repo.commit, {verbose = option.get("verbose"), repodir = repodir_local}); return true end}
if not ok then
if global.get("network") ~= "private" then
-- pull the latest commit
@@ -84,6 +85,8 @@ function _get_packagedir_from_locked_repo(packagename, locked_repo)
return
end
end
+ else
+ ok = true
end
end
@@ -162,10 +165,7 @@ function packagedir(packagename, opt)
-- find the package directory from the locked repository
if locked_repo then
- local dir, repo = _get_packagedir_from_locked_repo(packagename, locked_repo)
- if dir and repo then
- foundir = {dir, repo}
- end
+ foundir = _get_packagedir_from_locked_repo(packagename, locked_repo)
end
-- find the package directory from repositories