aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd_linux.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd_linux.go b/cmd_linux.go
index d9d392e..9a4da36 100644
--- a/cmd_linux.go
+++ b/cmd_linux.go
@@ -180,18 +180,16 @@ func syncFromManifest(remote *Manifest, stack *GitignoreStack) {
localManifest := scanLocalDirectory(*dataDir)
+ // First pass: count what needs syncing
+ var toSync []string
for relPath, remoteMeta := range remote.Files {
if isGitDir(relPath) {
continue
}
if stack.IsIgnored(relPath) {
- stats.skipped++
continue
}
- destPath := filepath.Join(*dataDir, relPath)
- srcPath := filepath.Join(*hostDir, relPath)
-
if localMeta, exists := localManifest.Files[relPath]; exists {
if localMeta.Size == remoteMeta.Size &&
localMeta.Mode == remoteMeta.Mode &&
@@ -201,6 +199,15 @@ func syncFromManifest(remote *Manifest, stack *GitignoreStack) {
}
}
+ toSync = append(toSync, relPath)
+ }
+ logInfo("manifest: %d files to sync", len(toSync))
+
+ // Second pass: sync
+ for _, relPath := range toSync {
+ destPath := filepath.Join(*dataDir, relPath)
+ srcPath := filepath.Join(*hostDir, relPath)
+
info, err := os.Lstat(srcPath)
if err != nil {
if os.IsNotExist(err) {