summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-31 22:40:05 +0800
committerGitHub <[email protected]>2022-05-31 22:40:05 +0800
commit672b4781acbb68fa0e97e35003a15747a9e938cf (patch)
tree9d2be21ea8de91563d446546c9e1e046b720decd
parent6864c894f98de97072338361c1043981a716d972 (diff)
parentbb3a362399133b112f7bcbf97d326c457beca470 (diff)
Merge pull request #2411 from Arthapz/dev
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