diff options
| author | ruki <[email protected]> | 2022-04-16 17:18:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-16 17:18:03 +0800 |
| commit | 714109541cda305c832588e9058b307f90455989 (patch) | |
| tree | f6ce2f1974e59028a80fbf52c7111d7dcf81c5a1 | |
| parent | b625ced105994f15883c5ab6a5122738bfb8b922 (diff) | |
fix sync error
| -rw-r--r-- | xmake/modules/private/service/remote_build/filesync.lua | 11 | ||||
| -rw-r--r-- | xmake/modules/private/service/remote_build/session.lua | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/xmake/modules/private/service/remote_build/filesync.lua b/xmake/modules/private/service/remote_build/filesync.lua index e0fc2c0d6..d00439a29 100644 --- a/xmake/modules/private/service/remote_build/filesync.lua +++ b/xmake/modules/private/service/remote_build/filesync.lua @@ -81,8 +81,9 @@ end -- do snapshot, it will re-scan all and update to manifest file function filesync:snapshot() local rootdir = self:rootdir() - assert(rootdir and os.isdir(rootdir), "reset %s failed, rootdir not found!", rootdir) - local manifest = self:manifest() + assert(rootdir and os.isdir(rootdir), "get snapshot %s failed, rootdir not found!", rootdir) + local manifest = {} + local manifest_old = self:manifest() local ignorefiles = self:ignorefiles() if ignorefiles then ignorefiles = "|" .. table.concat(ignorefiles, "|") @@ -90,10 +91,12 @@ function filesync:snapshot() for _, filepath in ipairs(os.files(path.join(rootdir, "**" .. ignorefiles))) do local fileitem = path.relative(filepath, rootdir) if fileitem then - local manifest_info = manifest[fileitem] + local manifest_info = manifest_old[fileitem] local mtime = os.mtime(filepath) if not manifest_info or not manifest_info.mtime or mtime > manifest_info.mtime then manifest[fileitem] = {sha256 = hash.sha256(filepath), mtime = mtime} + else + manifest[fileitem] = manifest_info end end end @@ -111,7 +114,7 @@ function filesync:update(fileitem, filepath, sha256) end -- remove file -function filesync:remote(fileitem) +function filesync:remove(fileitem) local manifest = self:manifest() manifest[fileitem] = nil end diff --git a/xmake/modules/private/service/remote_build/session.lua b/xmake/modules/private/service/remote_build/session.lua index 61caf0163..9f81809e6 100644 --- a/xmake/modules/private/service/remote_build/session.lua +++ b/xmake/modules/private/service/remote_build/session.lua @@ -103,7 +103,7 @@ function session:diff(respmsg) table.insert(inserted, fileitem) changed = true vprint("[+]: %s", fileitem) - elseif not manifest_info_server and manifest_info_client then + elseif manifest_info_server and not manifest_info_client then table.insert(removed, fileitem) changed = true vprint("[-]: %s", fileitem) |
