summaryrefslogtreecommitdiff
path: root/xmake/modules/devel/git/submodule/update.lua
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2021-07-15 23:23:48 -0300
committerÂngelo Andrade Cirino <[email protected]>2021-07-15 23:23:48 -0300
commit81ad292ea67f82d88d785a37d23b1f1603996da1 (patch)
tree817b50173948547f7e4b491da271918c67b8a5ff /xmake/modules/devel/git/submodule/update.lua
parent942c32f448d9b8a850438aa2af1de2415b7ae872 (diff)
parent8c1141aba414c07554179cb28687124514f6e770 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'xmake/modules/devel/git/submodule/update.lua')
-rw-r--r--xmake/modules/devel/git/submodule/update.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/xmake/modules/devel/git/submodule/update.lua b/xmake/modules/devel/git/submodule/update.lua
index 6256c673f..5d9323a02 100644
--- a/xmake/modules/devel/git/submodule/update.lua
+++ b/xmake/modules/devel/git/submodule/update.lua
@@ -30,8 +30,8 @@ import("lib.detect.find_tool")
--
-- import("devel.git.submodule")
--
--- submodule.update("master", {repodir = "/tmp/xmake", init = true, remote = true})
--- submodule.update("v1.0.1", {repodir = "/tmp/xmake", recursive = true, reference = "xxx", paths = "xxx"})
+-- submodule.update({repodir = "/tmp/xmake", init = true, remote = true})
+-- submodule.update({repodir = "/tmp/xmake", recursive = true, longpaths = true, reference = "xxx", paths = "xxx"})
--
-- @endcode
--
@@ -64,9 +64,29 @@ function main(opt)
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}
+ if not longpaths_old or not longpaths_old:find("true") then
+ os.vrunv(git.program, {"config", "--global", "core.longpaths", "true"})
+ longpaths_changed = true
+ end
+ end
+
-- submodule it
os.vrunv(git.program, argv)
+ -- 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"})
+ else
+ os.vrunv(git.program, {"config", "--global", "--unset", "core.longpaths"})
+ end
+ end
+
-- leave repository directory
if oldir then
os.cd(oldir)