summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/submodule/reset.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-09 22:42:55 +0800
committerruki <[email protected]>2024-04-09 22:42:55 +0800
commit253f8b39b4f1ee36212ea37bd05d879aa71fdbc2 (patch)
tree837d9de62a48ba941733fff3e0e5f2d8a52983f8 /xmake/modules/devel/git/submodule/reset.lua
parent4fb23e31746f9319e0409592a1b73350ab984f09 (diff)
improve longpaths for submodules
Diffstat (limited to 'xmake/modules/devel/git/submodule/reset.lua')
-rw-r--r--xmake/modules/devel/git/submodule/reset.lua26
1 files changed, 6 insertions, 20 deletions
diff --git a/xmake/modules/devel/git/submodule/reset.lua b/xmake/modules/devel/git/submodule/reset.lua
index f3c5ca45a..3c40bba9b 100644
--- a/xmake/modules/devel/git/submodule/reset.lua
+++ b/xmake/modules/devel/git/submodule/reset.lua
@@ -48,6 +48,12 @@ function main(opt)
table.insert(argv, "-c")
table.insert(argv, "core.fsmonitor=false")
end
+
+ -- use longpaths, we need it on windows
+ if opt.longpaths then
+ table.insert(argv, "-c")
+ table.insert(argv, "core.longpaths=true")
+ end
table.join2(argv, "submodule", "foreach", "--recursive", "git", "reset")
-- verbose?
@@ -75,26 +81,6 @@ function main(opt)
table.insert(argv, opt.commit)
end
- -- enable long paths
- local longpaths_old
- local longpaths_changed = false
- if opt.longpaths then
- local longpaths_old = try {function () return os.iorunv(git.program, {"config", "--get", "--global", "core.longpaths"}, {curdir = opt.repodir}) end}
- if not longpaths_old or not longpaths_old:find("true") then
- os.vrunv(git.program, {"config", "--global", "core.longpaths", "true"}, {curdir = opt.repodir})
- longpaths_changed = true
- end
- end
-
-- reset it
os.vrunv(git.program, argv, {curdir = opt.repodir})
-
- -- restore old long paths configuration
- if longpaths_changed then
- if longpaths_old and longpaths_old:find("false") then
- os.vrunv(git.program, {"config", "--global", "core.longpaths", "false"}, {curdir = opt.repodir})
- else
- os.vrunv(git.program, {"config", "--global", "--unset", "core.longpaths"}, {curdir = opt.repodir})
- end
- end
end