summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-13 16:49:46 +0800
committerruki <[email protected]>2022-03-13 16:49:46 +0800
commitfd3212860f087849cd59c0435f66da2aac52f32a (patch)
tree902699a1d4d4a1ef7eb71f5d4c0e9e8da1fef9f5 /xmake/plugins
parent321b13a3b93168eb840d3cb395300b5e43288307 (diff)
improve to pull repo
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/repo/main.lua20
1 files changed, 1 insertions, 19 deletions
diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua
index 4baa1f540..64240cd7a 100644
--- a/xmake/plugins/repo/main.lua
+++ b/xmake/plugins/repo/main.lua
@@ -94,39 +94,21 @@ function _update()
-- pull all repositories
local pulled = {}
for _, repo in ipairs(repos) do
-
- -- the repository directory
local repodir = repo:directory()
-
- -- remove repeat and only pull the first repository
if not pulled[repodir] then
if os.isdir(repodir) then
-
- -- update the local repository with the remote url
+ -- only update the local repository with the remote url
if not os.isdir(repo:url()) then
-
- -- trace
vprint("pulling repository(%s): %s to %s ..", repo:name(), repo:url(), repodir)
-
- -- pull it
git.pull({verbose = option.get("verbose"), branch = repo:branch() or "master", repodir = repodir})
-
- -- mark as updated
io.save(path.join(repodir, "updated"), {})
end
else
- -- trace
vprint("cloning repository(%s): %s to %s ..", repo:name(), repo:url(), repodir)
-
- -- clone it
local remoteurl = proxy.mirror(repo:url()) or repo:url()
git.clone(remoteurl, {verbose = option.get("verbose"), branch = repo:branch() or "master", outputdir = repodir})
-
- -- mark as updated
io.save(path.join(repodir, "updated"), {})
end
-
- -- pull this repository ok
pulled[repodir] = true
end
end