summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-05-31 14:14:01 +0200
committerArthur LAURENT <[email protected]>2022-05-31 14:14:01 +0200
commitbb3a362399133b112f7bcbf97d326c457beca470 (patch)
tree19579b85f406ea1dad6829ca2c31f16b5f1b2071
parent0428cdc48b8932407ca499134ecaffb5ddc3ae09 (diff)
don't assume .git directory when downloading dependency
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index e1853e3c7..7d0666c4e 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -38,7 +38,7 @@ function _checkout(package, url, sourcedir, url_alias)
-- use previous source directory if exists
local packagedir = path.join(sourcedir, package:name())
- if os.isdir(packagedir) and
+ if os.isdir(path.join(packagedir, ".git")) and
not (option.get("force") and package:branch()) then -- we need disable cache if we force to clone from the given branch
-- clean the previous build files
@@ -56,7 +56,7 @@ function _checkout(package, url, sourcedir, url_alias)
-- we can use local package from the search directories directly if network is too slow
local localdir = find_directory(package:name() .. archive.extension(url), core_package.searchdirs())
- if localdir and os.isdir(localdir) then
+ if localdir and os.isdir(path.join(localdir, ".git")) then
git.clean({repodir = localdir, force = true, all = true})
git.reset({repodir = localdir, hard = true})
if os.isfile(path.join(localdir, ".gitmodules")) then