From 747a37bc63bedf5a67dbf73922419eca23c3e9b0 Mon Sep 17 00:00:00 2001 From: allen Date: Fri, 3 Nov 2023 21:39:57 +0800 Subject: fix skipped patch if source package no git index --- xmake/modules/devel/git/apply.lua | 3 +++ xmake/modules/private/action/require/impl/actions/patch_sources.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1