summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-03 10:24:03 -0500
committerGitHub <[email protected]>2023-11-03 10:24:03 -0500
commit264f224e27e02a843dba82cc4362088d5db13e27 (patch)
treede573ad76a2407cee3f6b44228bef13b4d7a7f30
parent0f6e9d8f999137b5704299d0ed99ee42193ee55e (diff)
parent747a37bc63bedf5a67dbf73922419eca23c3e9b0 (diff)
Merge pull request #4358 from ivanallen/fix-4356
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