diff options
| author | ruki <[email protected]> | 2021-08-29 21:56:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-29 21:56:52 +0800 |
| commit | ab2c5e2a3b29bb63b23a7fa59c3f6d56cc56c47c (patch) | |
| tree | 0d2324fcf8b215228a0c1ce49baed48b61b792cf /xmake/modules/devel/git/pull.lua | |
| parent | 4497dd33fb475a388d5d51192d432b0156be78a3 (diff) | |
improve git ops
Diffstat (limited to 'xmake/modules/devel/git/pull.lua')
| -rw-r--r-- | xmake/modules/devel/git/pull.lua | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/xmake/modules/devel/git/pull.lua b/xmake/modules/devel/git/pull.lua index 9970f8dbc..412e6e757 100644 --- a/xmake/modules/devel/git/pull.lua +++ b/xmake/modules/devel/git/pull.lua @@ -58,18 +58,12 @@ function main(opt) table.insert(argv, "--tags") end - -- enter repository directory - local oldir = nil - if opt.repodir then - oldir = os.cd(opt.repodir) - end - -- use proxy? local envs 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"}) end } + 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+") @@ -86,10 +80,5 @@ function main(opt) end -- pull it - os.vrunv(git.program, argv, {envs = envs}) - - -- leave repository directory - if oldir then - os.cd(oldir) - end + os.vrunv(git.program, argv, {envs = envs, curdir = opt.repodir}) end |
