summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-30 11:15:59 +0800
committerruki <[email protected]>2022-10-30 11:15:59 +0800
commit441628171fac4ea543c1c87f66c533237c2067e4 (patch)
treed03ae0e748048921c6cab2b64bf3686a270c1a5a
parentb3f903777bfde99b9d69aaa2183175d3babe289b (diff)
improve git module
-rw-r--r--xmake/modules/devel/git/checkout.lua10
-rw-r--r--xmake/modules/devel/git/clean.lua8
-rw-r--r--xmake/modules/devel/git/clone.lua6
-rw-r--r--xmake/modules/devel/git/pull.lua7
-rw-r--r--xmake/modules/devel/git/reset.lua7
-rw-r--r--xmake/modules/devel/git/submodule/clean.lua7
-rw-r--r--xmake/modules/devel/git/submodule/reset.lua7
-rw-r--r--xmake/modules/devel/git/submodule/update.lua8
8 files changed, 53 insertions, 7 deletions
diff --git a/xmake/modules/devel/git/checkout.lua b/xmake/modules/devel/git/checkout.lua
index fb1a24e27..65ea1e820 100644
--- a/xmake/modules/devel/git/checkout.lua
+++ b/xmake/modules/devel/git/checkout.lua
@@ -39,6 +39,14 @@ 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 ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 52fa81a0b..20265687b 100644
--- a/xmake/modules/devel/git/clean.lua
+++ b/xmake/modules/devel/git/clean.lua
@@ -44,7 +44,13 @@ function main(opt)
local git = assert(find_tool("git"), "git not found!")
-- init argv
- local argv = {"clean", "-d"}
+ local argv = {}
+ if opt.fsmonitor ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 534ae8ac3..f821b8b24 100644
--- a/xmake/modules/devel/git/clone.lua
+++ b/xmake/modules/devel/git/clone.lua
@@ -77,6 +77,12 @@ function main(url, opt)
table.insert(argv, "core.longpaths=true")
end
+ -- set fsmonitor
+ if opt.fsmonitor ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 412e6e757..c5f1f6a55 100644
--- a/xmake/modules/devel/git/pull.lua
+++ b/xmake/modules/devel/git/pull.lua
@@ -45,7 +45,12 @@ function main(opt)
local git = assert(find_tool("git"), "git not found!")
-- init argv
- local argv = {"pull"}
+ local argv = {}
+ if opt.fsmonitor ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ end
+ table.insert(argv, "pull")
-- set remote
table.insert(argv, opt.remote or "origin")
diff --git a/xmake/modules/devel/git/reset.lua b/xmake/modules/devel/git/reset.lua
index 4ed798d25..e9fbe6c30 100644
--- a/xmake/modules/devel/git/reset.lua
+++ b/xmake/modules/devel/git/reset.lua
@@ -44,7 +44,12 @@ function main(opt)
local git = assert(find_tool("git"), "git not found!")
-- init argv
- local argv = {"reset"}
+ local argv = {}
+ if opt.fsmonitor ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 e21e2c6f1..c1817257c 100644
--- a/xmake/modules/devel/git/submodule/clean.lua
+++ b/xmake/modules/devel/git/submodule/clean.lua
@@ -44,7 +44,12 @@ 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 ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 f9dd01753..1095310e7 100644
--- a/xmake/modules/devel/git/submodule/reset.lua
+++ b/xmake/modules/devel/git/submodule/reset.lua
@@ -44,7 +44,12 @@ 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 ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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 511684c1c..d81495a88 100644
--- a/xmake/modules/devel/git/submodule/update.lua
+++ b/xmake/modules/devel/git/submodule/update.lua
@@ -44,7 +44,13 @@ function main(opt)
local git = assert(find_tool("git"), "git not found!")
-- init argv
- local argv = {"submodule", "update"}
+ local argv = {}
+ if opt.fsmonitor ~= nil then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.fsmonitor=" .. tostring(opt.fsmonitor))
+ 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)