Skip to content

recreate: also do the work if --timestamp is the only change requested - #10302

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:recreate-timestamp-only
Sep 2, 2026
Merged

recreate: also do the work if --timestamp is the only change requested#10302
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:recreate-timestamp-only

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Problem

borg recreate -a ARCHIVE --timestamp ... with no other change requested (no PATHs/patterns, no --chunker-params, no --comment) printed Skipped archive ...: Nothing to do. and silently did not apply the requested timestamp, contradicting the option's help text.

The work-trigger gate in ArchiveRecreater.recreate() only considered the matcher, rechunking and the comment — not self.timestamp, although the value is correctly plumbed all the way to target.save(timestamp=...).

Fix

Include self.timestamp is None in the gate.

Tests

test_recreate_with_given_timestamp now passes only --timestamp (previously it also passed --comment, which triggered the work and masked this bug) — it fails on master and passes with this fix.

Both timestamp tests also gave the archive name as a positional argument, but recreate positionals are PATHs in borg2: this made the matcher accidentally non-empty (also masking the bug) and recreated the archive with zero items, unnoticed. They now select the archive via -a and assert that the items survive the recreate.

🤖 Generated with Claude Code

ArchiveRecreater.recreate() skipped the archive ("Nothing to do.") when
neither patterns/paths, nor rechunking, nor a new comment were given,
silently ignoring a requested --timestamp change.

Also fix the timestamp tests: they gave the archive name as a positional
argument, but recreate positionals are PATHs in borg2, so the matcher was
accidentally non-empty (hiding this bug) and the recreated archive did not
contain any items at all. Select the archive via -a and assert that the
items survive the recreate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.69%. Comparing base (0adbb7a) to head (46030f3).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10302      +/-   ##
==========================================
+ Coverage   87.65%   87.69%   +0.03%     
==========================================
  Files         103      103              
  Lines       18702    18712      +10     
  Branches     2877     2880       +3     
==========================================
+ Hits        16393    16409      +16     
+ Misses       1609     1600       -9     
- Partials      700      703       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit 4a9ad9b into borgbackup:master Sep 2, 2026
26 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the recreate-timestamp-only branch September 2, 2026 00:02
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.

1 participant