summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallen <[email protected]>2023-11-03 21:39:57 +0800
committerallen <[email protected]>2023-11-03 22:36:33 +0800
commit747a37bc63bedf5a67dbf73922419eca23c3e9b0 (patch)
treede573ad76a2407cee3f6b44228bef13b4d7a7f30
parent0f6e9d8f999137b5704299d0ed99ee42193ee55e (diff)
fix skipped patch if source package no git index
-rw-r--r--xmake/modules/devel/git/apply.lua3
-rw-r--r--xmake/modules/private/action/require/impl/actions/patch_sources.lua2
2 files changed, 4 insertions, 1 deletions
diff --git a/xmake/modules/devel/git/apply.lua b/xmake/modules/devel/git/apply.lua
index b5f59ab49..5934da380 100644
--- a/xmake/modules/devel/git/apply.lua
+++ b/xmake/modules/devel/git/apply.lua
@@ -39,5 +39,8 @@ function main(patchfile, opt)
opt = opt or {}
local git = assert(find_tool("git"), "git not found!")
local argv = {"apply", "--reject", "--ignore-whitespace", patchfile}
+ if opt.gitdir then
+ table.insert(argv, 1, "--git-dir=" .. opt.gitdir)
+ end
os.vrunv(git.program, argv, {curdir = opt.repodir})
end
diff --git a/xmake/modules/private/action/require/impl/actions/patch_sources.lua b/xmake/modules/private/action/require/impl/actions/patch_sources.lua
index 5306fbb9a..79446c0b3 100644
--- a/xmake/modules/private/action/require/impl/actions/patch_sources.lua
+++ b/xmake/modules/private/action/require/impl/actions/patch_sources.lua
@@ -98,7 +98,7 @@ function _patch(package, patch_url, patch_hash)
end
-- apply the patch file
- git.apply(patch_file)
+ git.apply(patch_file, {gitdir = os.curdir()})
end
-- patch the given package