manifest.Build snapshots `ours` once before Pull applies any writes. A local edit landing after that snapshot but before writeEntry looked unchanged (oursCh false) and got overwritten with the hub version verbatim, with no conflict copy — the edit's bytes ended up in no file and no snapshot. Re-stat/re-hash the on-disk file right before a hub-only write would apply and compare it against the entry manifest.Build captured. A mismatch routes through the existing preserve-as-conflict path instead of clobbering. Only checked when hub is about to write over a path `ours` already knew about — a pure hub-only add has nothing on disk yet to race with. This narrows the window, it doesn't close it: a rename at pull.go:424-451 still isn't atomic with this check. A real fix needs a filesystem-level lock or lease around the whole pull, tracked separately. Includes the untracked repro (zz_repro_stale_ours_test.go) that found this. |
||
|---|---|---|
| .. | ||
| manifest.go | ||
| manifest_test.go | ||