diff options
| author | ruki <[email protected]> | 2018-10-09 00:40:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-10-08 22:03:13 +0800 |
| commit | 17a1749337c56f361cea51f43ff59b43a7954d34 (patch) | |
| tree | a191cee5dcda2277b5be1cb386125c0c1be9266d | |
| parent | 5e8c2f16adcd0f0549a8c7f019fb7f8bf3d4732a (diff) | |
check the updated repo
| -rw-r--r-- | xmake/actions/require/impl/repository.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/repo/main.lua | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/xmake/actions/require/impl/repository.lua b/xmake/actions/require/impl/repository.lua index f9fa4d3cb..632320589 100644 --- a/xmake/actions/require/impl/repository.lua +++ b/xmake/actions/require/impl/repository.lua @@ -46,7 +46,9 @@ end -- the remote repositories have been pulled? function pulled() for _, repo in ipairs(repositories()) do - if not os.isdir(repo:directory()) then + -- repository not found? or xmake has been re-installed + local updatefile = path.join(repo:directory(), "updated") + if not os.isdir(repo:directory()) or (os.isfile(updatefile) and os.mtime(os.programfile()) > os.mtime(updatefile)) then return false end end diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua index 10a279cfe..e91682fcf 100644 --- a/xmake/plugins/repo/main.lua +++ b/xmake/plugins/repo/main.lua @@ -109,6 +109,9 @@ function _update() -- pull it git.pull({verbose = option.get("verbose"), branch = "master", repodir = repodir}) + + -- mark as updated + io.save(path.join(repodir, "updated"), {}) end else -- trace @@ -116,6 +119,9 @@ function _update() -- clone it git.clone(repo:url(), {verbose = option.get("verbose"), branch = "master", outputdir = repodir}) + + -- mark as updated + io.save(path.join(repodir, "updated"), {}) end -- pull this repository ok |
