More backups. Less history. How does that happen?
Описание и применение
Автоматические инструменты, создающие резервные копии при каждом запуске, могут перезаписывать полезную историю, если объединяемые настройки идентичны. Патч, сравнивающий байты, предотвращает создание дублирующих файлов, сохраняя исходные настройки.
Задача
Automated tools that create a backup on every launch can overwrite useful history when successive merges are identical, leading to a backup folder that contains only the latest version and no recoverable older settings.
Результат
The patch prevents unnecessary backups when the merged content is byte‑identical, reducing backup count from ten to one and preserving the original configuration. However, formatting changes still produce new backups, indicating that deduplication is based on byte equality, not semantic changes.
Рабочий процесс
- 1. Start with an old configuration file.
- 2. Merge a new setting into the file using the original code.
- 3. Repeat the merge 27 times with identical content.
- 4. Observe that 10 backup files are kept, all identical to the current file, and the original settings are lost.
- 5. Apply the patch that compares the proposed output with the existing bytes before writing.
- 6. Repeat steps 1–3 with the patched code.
- 7. Observe that only one backup file is kept and the original settings survive.
- 8. Run eight concurrent processes after the initial change to test lock protection.
- 9. Verify that the patched version retains only the original backup while the original code retains nine backups of the new content.
- 10. Perform deliberate formatting rewrites to test byte‑identical detection.
- 11. Observe that both versions keep ten backups and lose the original settings when formatting changes bytes.
Доказательства
Before the patch, later merges kept saving the new settings again until the first backup fell outside the ten-file window.
After the patch, unchanged merges stopped consuming that window. Fewer backup files preserved more useful history.
We also ran eight concurrent processes after the initial change. The old version retained nine backups; the patched version retained only the original old content.
- Дата записи: 2026-09-21T11:30:23.627Z