Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

bisync: fix --conflict-resolve comparing a zero size or modtime

nielash1fd50dae9ca6
diff --git a/cmd/bisync/deltas.go b/cmd/bisync/deltas.go
index c9ab491c5..aecdacb16 100644
--- a/cmd/bisync/deltas.go
+++ b/cmd/bisync/deltas.go
@@ -182,9 +182,6 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing string,
for _, file := range old.list {
// REMEMBER: this section is only concerned with comparing listings from the same side (not different sides)
d := deltaZero
- s := int64(0)
- h := ""
- var t time.Time
if !now.has(file) {
b.indent(msg, file, Color(terminal.RedFg, "File was deleted"))
ds.deleted++
@@ -202,7 +199,6 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing string,
whatchanged = append(whatchanged, Color(terminal.MagentaFg, "size (smaller)"))
d |= deltaSmaller
}
- s = now.getSize(file)
}
}
if b.opt.Compare.Modtime {
@@ -216,7 +212,6 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing string,
whatchanged = append(whatchanged, Color(terminal.MagentaFg, "time (older)"))
d |= deltaOlder
}
- t = now.getTime(file)
}
}
if b.opt.Compare.Checksum {
@@ -224,7 +219,6 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing string,
fs.Debugf(file, "(old: %v current: %v)", old.getHash(file), now.getHash(file))
whatchanged = append(whatchanged, Color(terminal.MagentaFg, "hash"))
d |= deltaHash
- h = now.getHash(file)
}
}
// concat changes and print log
@@ -237,13 +231,13 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing string,
if d.is(deltaModified) {
ds.deltas[file] = d
if b.opt.Compare.Size {
- ds.size[file] = s
+ ds.size[file] = now.getSize(file)
}
if b.opt.Compare.Modtime {
- ds.time[file] = t
+ ds.time[file] = now.getTime(file)
}
if b.opt.Compare.Checksum {
- ds.hash[file] = h
+ ds.hash[file] = now.getHash(file)
}
} else if d.is(deltaDeleted) {
ds.deltas[file] = d
diff --git a/cmd/bisync/testdata/test_resolve/golden/test.log b/cmd/bisync/testdata/test_resolve/golden/test.log
index 8aaf9a751..3fe99dfc7 100644
--- a/cmd/bisync/testdata/test_resolve/golden/test.log
+++ b/cmd/bisync/testdata/test_resolve/golden/test.log
@@ -151,7 +151,7 @@ NOTICE: {path2String}: 1 differences found
NOTICE: {path2String}: 1 errors while checking
INFO : Finished checking the potential conflicts. 1 differences found
NOTICE: - WARNING New or changed in both paths - file1.txt
-INFO : file1.txt: Winner cannot be determined as sizes are equal. Path1: 0, Path2: 0, Difference: 0
+INFO : file1.txt: Winner cannot be determined as sizes are equal. Path1: 33, Path2: 33, Difference: 0
INFO : file1.txt: A winner could not be determined.
NOTICE: - Path1 Renaming Path1 copy - {path1/}file1.txt.apple1
NOTICE: - Path1 Queue copy to Path2 - {path2/}file1.txt.apple1
diff --git a/docs/content/bisync.md b/docs/content/bisync.md
index 6d3f42a0a..99fd7932a 100644
--- a/docs/content/bisync.md
+++ b/docs/content/bisync.md
@@ -1939,6 +1939,7 @@ about *Unison* and synchronization in general.
the `--max-delete` safety check when used with `--track-renames`.
- Fixed an issue causing the conflict winner to be missing from listings when
Path2 won.
+- Fixed an issue causing `--conflict-resolve` to compare a zero size or modtime.
### `v1.74.2`