diff options
| author | ruki <[email protected]> | 2025-12-03 00:36:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-03 00:36:06 +0800 |
| commit | f9b12064a91aa52c55bbdac82d6ae2788fdf0d14 (patch) | |
| tree | 804ac2ef175773fad03b2d7948d89e9b2fb8154e /xmake/modules/devel/git/pull.lua | |
| parent | 32ab2513cedfb907b7397dc571b45d36a366c1c2 (diff) | |
improve git.pull
Diffstat (limited to 'xmake/modules/devel/git/pull.lua')
| -rw-r--r-- | xmake/modules/devel/git/pull.lua | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/xmake/modules/devel/git/pull.lua b/xmake/modules/devel/git/pull.lua index eebf806b9..ea432461b 100644 --- a/xmake/modules/devel/git/pull.lua +++ b/xmake/modules/devel/git/pull.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("devel.git.remote") import("lib.detect.find_tool") import("net.proxy") @@ -77,18 +78,9 @@ function main(opt) local proxy_conf = proxy.config() if proxy_conf then -- get proxy configuration from the current remote url - local remoteinfo = try { function() return os.iorunv(git.program, {"remote", "-v"}, {curdir = opt.repodir}) end } - if remoteinfo then - for _, line in ipairs(remoteinfo:split('\n', {plain = true})) do - local splitinfo = line:split("%s+") - if #splitinfo > 1 and splitinfo[1] == (opt.remote or "origin") then - local url = splitinfo[2] - if url then - proxy_conf = proxy.config(url) - end - break - end - end + local url = remote.get_url({remote = opt.remote or "origin", repodir = opt.repodir}) + if url then + proxy_conf = proxy.config(url) end envs = {ALL_PROXY = proxy_conf} end |
