When "--match-archives *" is used with "check" action, don't skip Borg's orphaned objects check (#779).

This commit is contained in:
Dan Helfman 2024-04-16 10:38:14 -07:00
parent 7e51c41ebf
commit b0e49ebce0
3 changed files with 29 additions and 0 deletions

2
NEWS
View file

@ -4,6 +4,8 @@
catch problems like incorrect excludes, inadvertent deletes, files changed by malware, etc. See catch problems like incorrect excludes, inadvertent deletes, files changed by malware, etc. See
the documentation for more information: the documentation for more information:
https://torsion.org/borgmatic/docs/how-to/deal-with-very-large-backups/#spot-check https://torsion.org/borgmatic/docs/how-to/deal-with-very-large-backups/#spot-check
* #779: When "--match-archives *" is used with "check" action, don't skip Borg's orphaned objects
check.
* #842: When a command hook exits with a soft failure, ping the log and finish states for any * #842: When a command hook exits with a soft failure, ping the log and finish states for any
configured monitoring hooks. configured monitoring hooks.
* #843: Add documentation link to Loki dashboard for borgmatic: * #843: Add documentation link to Loki dashboard for borgmatic:

View file

@ -74,6 +74,9 @@ def make_match_archives_flags(match_archives, archive_name_format, local_borg_ve
(like "{now}") with globs. (like "{now}") with globs.
''' '''
if match_archives: if match_archives:
if match_archives in {'*', 're:.*', 'sh:*'}:
return ()
if feature.available(feature.Feature.MATCH_ARCHIVES, local_borg_version): if feature.available(feature.Feature.MATCH_ARCHIVES, local_borg_version):
return ('--match-archives', match_archives) return ('--match-archives', match_archives)
else: else:

View file

@ -151,6 +151,30 @@ def test_make_repository_archive_flags_with_borg_features_joins_repository_and_a
False, False,
('--glob-archives', '*-docs-{user}'), # noqa: FS003 ('--glob-archives', '*-docs-{user}'), # noqa: FS003
), ),
(
'*',
'{now}', # noqa: FS003
True,
(),
),
(
'*',
'{now}', # noqa: FS003
False,
(),
),
(
're:.*',
'{now}', # noqa: FS003
True,
(),
),
(
'sh:*',
'{now}', # noqa: FS003
True,
(),
),
), ),
) )
def test_make_match_archives_flags_makes_flags_with_globs( def test_make_match_archives_flags_makes_flags_with_globs(