summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/submodule/update.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-29 21:56:52 +0800
committerruki <[email protected]>2021-08-29 21:56:52 +0800
commitab2c5e2a3b29bb63b23a7fa59c3f6d56cc56c47c (patch)
tree0d2324fcf8b215228a0c1ce49baed48b61b792cf /xmake/modules/devel/git/submodule/update.lua
parent4497dd33fb475a388d5d51192d432b0156be78a3 (diff)
improve git ops
Diffstat (limited to 'xmake/modules/devel/git/submodule/update.lua')
-rw-r--r--xmake/modules/devel/git/submodule/update.lua21
1 files changed, 5 insertions, 16 deletions
diff --git a/xmake/modules/devel/git/submodule/update.lua b/xmake/modules/devel/git/submodule/update.lua
index 5d9323a02..881663706 100644
--- a/xmake/modules/devel/git/submodule/update.lua
+++ b/xmake/modules/devel/git/submodule/update.lua
@@ -58,37 +58,26 @@ function main(opt)
table.join2(argv, opt.paths)
end
- -- enter repository directory
- local oldir = nil
- if opt.repodir then
- oldir = os.cd(opt.repodir)
- 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"}) end}
+ 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"})
+ os.vrunv(git.program, {"config", "--global", "core.longpaths", "true"}, {curdir = opt.repodir})
longpaths_changed = true
end
end
-- submodule it
- os.vrunv(git.program, argv)
+ 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"})
+ os.vrunv(git.program, {"config", "--global", "core.longpaths", "false"}, {curdir = opt.repodir})
else
- os.vrunv(git.program, {"config", "--global", "--unset", "core.longpaths"})
+ os.vrunv(git.program, {"config", "--global", "--unset", "core.longpaths", {curdir = opt.repodir}})
end
end
-
- -- leave repository directory
- if oldir then
- os.cd(oldir)
- end
end