diff --git a/xmake/modules/devel/git/checkout.lua b/xmake/modules/devel/git/checkout.lua index fb1a24e272d..61919e4229f 100644 --- a/xmake/modules/devel/git/checkout.lua +++ b/xmake/modules/devel/git/checkout.lua @@ -39,6 +39,16 @@ import("lib.detect.find_tool") function main(commit, opt) opt = opt or {} local git = assert(find_tool("git"), "git not found!") - local argv = {"checkout", commit} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + + table.insert(argv, "checkout") + table.insert(argv, commit) os.vrunv(git.program, argv, {curdir = opt.repodir}) end diff --git a/xmake/modules/devel/git/clean.lua b/xmake/modules/devel/git/clean.lua index 52fa81a0b62..91b6b5c8242 100644 --- a/xmake/modules/devel/git/clean.lua +++ b/xmake/modules/devel/git/clean.lua @@ -44,7 +44,16 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"clean", "-d"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.insert(argv, "clean") + table.insert(argv, "-d") -- verbose? if not option.get("verbose") then diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua index 534ae8ac3d4..58f43462d1d 100644 --- a/xmake/modules/devel/git/clone.lua +++ b/xmake/modules/devel/git/clone.lua @@ -77,6 +77,15 @@ function main(url, opt) table.insert(argv, "core.longpaths=true") end + -- set fsmonitor + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + -- set outputdir if opt.outputdir then table.insert(argv, path.translate(opt.outputdir)) diff --git a/xmake/modules/devel/git/pull.lua b/xmake/modules/devel/git/pull.lua index 412e6e75762..a9923bb189a 100644 --- a/xmake/modules/devel/git/pull.lua +++ b/xmake/modules/devel/git/pull.lua @@ -45,7 +45,15 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"pull"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.insert(argv, "pull") -- set remote table.insert(argv, opt.remote or "origin") diff --git a/xmake/modules/devel/git/push.lua b/xmake/modules/devel/git/push.lua index b56ea40598a..02585f0201c 100644 --- a/xmake/modules/devel/git/push.lua +++ b/xmake/modules/devel/git/push.lua @@ -39,8 +39,16 @@ import("branch", {alias = "git_branch"}) function main(url, opt) opt = opt or {} local git = assert(find_tool("git"), "git not found!") - - local argv = {"push", url} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.insert(argv, "push") + table.insert(argv, url) if opt.force then table.insert(argv, "--force") end diff --git a/xmake/modules/devel/git/reset.lua b/xmake/modules/devel/git/reset.lua index 4ed798d25a1..ba1a0f139c2 100644 --- a/xmake/modules/devel/git/reset.lua +++ b/xmake/modules/devel/git/reset.lua @@ -44,7 +44,15 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"reset"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.insert(argv, "reset") -- verbose? if not option.get("verbose") then diff --git a/xmake/modules/devel/git/submodule/clean.lua b/xmake/modules/devel/git/submodule/clean.lua index e21e2c6f1db..622dff3e75c 100644 --- a/xmake/modules/devel/git/submodule/clean.lua +++ b/xmake/modules/devel/git/submodule/clean.lua @@ -44,7 +44,15 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"submodule", "foreach", "--recursive", "git", "clean", "-d"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.join2(argv, "submodule", "foreach", "--recursive", "git", "clean", "-d") -- verbose? if not option.get("verbose") then diff --git a/xmake/modules/devel/git/submodule/reset.lua b/xmake/modules/devel/git/submodule/reset.lua index f9dd0175359..e0c7bf98da8 100644 --- a/xmake/modules/devel/git/submodule/reset.lua +++ b/xmake/modules/devel/git/submodule/reset.lua @@ -44,7 +44,15 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"submodule", "foreach", "--recursive", "git", "reset"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.join2(argv, "submodule", "foreach", "--recursive", "git", "reset") -- verbose? if not option.get("verbose") then diff --git a/xmake/modules/devel/git/submodule/update.lua b/xmake/modules/devel/git/submodule/update.lua index 511684c1cce..ee24bffcfce 100644 --- a/xmake/modules/devel/git/submodule/update.lua +++ b/xmake/modules/devel/git/submodule/update.lua @@ -44,7 +44,16 @@ function main(opt) local git = assert(find_tool("git"), "git not found!") -- init argv - local argv = {"submodule", "update"} + local argv = {} + if opt.fsmonitor then + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=true") + else + table.insert(argv, "-c") + table.insert(argv, "core.fsmonitor=false") + end + table.insert(argv, "submodule") + table.insert(argv, "update") for _, name in ipairs({"init", "remote", "force", "checkout", "merge", "rebase", "recursive"}) do if opt[name] then table.insert(argv, "--" .. name)