Current FastSync behavior:
There is no backup support. When --delete removes a file or an incremental transfer overwrites an existing file, the old version is lost permanently.
Before overwriting or deleting an existing destination file, rename it to <path><suffix> or move it to <backup-dir>/<relative-path><suffix>
Create backup directory tree as needed
Avoid backing up files that are already backups
Protocol: no wire changes; receiver performs backups before applying changes
Priority: medium Rationale: Backups are critical for safe synchronization, especially when --delete is used. Users need a safety net against accidental data loss.
Acceptance criteria:
--backup creates file.txt~ before overwriting file.txt
--backup-dir=backups moves old versions into backups/<relative-path>~
--suffix=.bak changes the backup suffix
Works for both --delete removals and incremental overwrites
Integration tests verify backup creation and content
**Corresponding rsync flags/behavior:**
- `--backup` — make backups of files that are about to be replaced or deleted
- `--backup-dir=DIR` — put backups into a separate directory hierarchy
- `--suffix=SUFFIX` — backup filename suffix (default `~`)
**Current FastSync behavior:**
There is no backup support. When `--delete` removes a file or an incremental transfer overwrites an existing file, the old version is lost permanently.
**Proposed changes:**
- CLI flags: `--backup`, `--backup-dir=<dir>`, `--suffix=<suffix>`
- Config fields: `bool use_backup`, `char* backup_dir`, `char* backup_suffix`
- Implementation:
- Before overwriting or deleting an existing destination file, rename it to `<path><suffix>` or move it to `<backup-dir>/<relative-path><suffix>`
- Create backup directory tree as needed
- Avoid backing up files that are already backups
- Protocol: no wire changes; receiver performs backups before applying changes
**Priority:** medium
**Rationale:** Backups are critical for safe synchronization, especially when `--delete` is used. Users need a safety net against accidental data loss.
**Acceptance criteria:**
- [ ] `--backup` creates `file.txt~` before overwriting `file.txt`
- [ ] `--backup-dir=backups` moves old versions into `backups/<relative-path>~`
- [ ] `--suffix=.bak` changes the backup suffix
- [ ] Works for both `--delete` removals and incremental overwrites
- [ ] Integration tests verify backup creation and content
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Corresponding rsync flags/behavior:
--backup— make backups of files that are about to be replaced or deleted--backup-dir=DIR— put backups into a separate directory hierarchy--suffix=SUFFIX— backup filename suffix (default~)Current FastSync behavior:
There is no backup support. When
--deleteremoves a file or an incremental transfer overwrites an existing file, the old version is lost permanently.Proposed changes:
--backup,--backup-dir=<dir>,--suffix=<suffix>bool use_backup,char* backup_dir,char* backup_suffix<path><suffix>or move it to<backup-dir>/<relative-path><suffix>Priority: medium
Rationale: Backups are critical for safe synchronization, especially when
--deleteis used. Users need a safety net against accidental data loss.Acceptance criteria:
--backupcreatesfile.txt~before overwritingfile.txt--backup-dir=backupsmoves old versions intobackups/<relative-path>~--suffix=.bakchanges the backup suffix--deleteremovals and incremental overwrites