Skip to content

Add explicit backup modes for cfgsync backup#76

Merged
olxgdm merged 10 commits into
mainfrom
75-add-explicit-backup-modes-for-missing-only-refresh-and-force-behavior
Jun 25, 2026
Merged

Add explicit backup modes for cfgsync backup#76
olxgdm merged 10 commits into
mainfrom
75-add-explicit-backup-modes-for-missing-only-refresh-and-force-behavior

Conversation

@olxgdm

@olxgdm olxgdm commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Why

The project history made backup semantics ambiguous: one workflow wanted only missing stored copies, while the current v0.3.1 behavior refreshes changed backups. This PR makes those choices explicit without changing the registry format, app config format, storage layout, restore flow, snapshots, or history model.

User impact

  • cfgsync backup continues to create missing backups, refresh changed backups, and skip matching backups.
  • cfgsync backup --missing-only creates only missing stored backups and preserves existing stored copies.
  • cfgsync backup --force overwrites every stored backup from the current tracked originals.
  • cfgsync backup --missing-only --force fails with a clear CLI validation error.

Implementation notes

  • Introduces BackupMode and keeps BackupCommand::Execute() defaulting to refresh-on-change.
  • Keeps batch backup behavior unchanged: per-file failures are warned, processing continues, and the command exits non-zero after the batch when failures occurred.
  • Keeps --missing-only from inspecting original files when a stored backup already exists, so existing backups can be preserved even if the original is currently missing.

Validation

  • cmake --build build
  • ctest --test-dir build --output-on-failure -R "BackupCommand|BackupCommandCli" (29/29 passed)
  • ctest --test-dir build --output-on-failure (251/251 passed)
  • build/cfgsync backup --help

Closes #75

@olxgdm olxgdm linked an issue Jun 25, 2026 that may be closed by this pull request
@olxgdm olxgdm marked this pull request as ready for review June 25, 2026 17:36
@sonarqubecloud

Copy link
Copy Markdown

@olxgdm olxgdm merged commit 4da75d9 into main Jun 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explicit backup modes for missing-only, refresh, and force behavior

1 participant