Omit "--glob-archives" or "--match-archives" Borg flag when its value would be "*" (#734).
This commit is contained in:
parent
e607de7df1
commit
14e2a6b89d
3 changed files with 24 additions and 7 deletions
2
NEWS
2
NEWS
|
@ -11,6 +11,8 @@
|
|||
* #732: Include multiple configuration files with a single "!include". See the documentation for
|
||||
more information:
|
||||
https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#multiple-merge-includes
|
||||
* #734: Omit "--glob-archives" or "--match-archives" Borg flag when its value would be "*" (meaning
|
||||
all archives).
|
||||
|
||||
1.8.0
|
||||
* #575: BREAKING: For the "borgmatic borg" action, instead of implicitly injecting
|
||||
|
|
|
@ -77,6 +77,9 @@ def make_match_archives_flags(match_archives, archive_name_format, local_borg_ve
|
|||
|
||||
derived_match_archives = re.sub(r'\{(now|utcnow|pid)([:%\w\.-]*)\}', '*', archive_name_format)
|
||||
|
||||
if derived_match_archives == '*':
|
||||
return ()
|
||||
|
||||
if feature.available(feature.Feature.MATCH_ARCHIVES, local_borg_version):
|
||||
return ('--match-archives', f'sh:{derived_match_archives}')
|
||||
else:
|
||||
|
|
|
@ -92,22 +92,22 @@ def test_make_repository_archive_flags_with_borg_features_joins_repository_and_a
|
|||
(None, '', True, ()),
|
||||
(
|
||||
're:foo-.*',
|
||||
'{hostname}-{now}',
|
||||
'{hostname}-{now}', # noqa: FS003
|
||||
True,
|
||||
('--match-archives', 're:foo-.*'),
|
||||
), # noqa: FS003
|
||||
),
|
||||
(
|
||||
'sh:foo-*',
|
||||
'{hostname}-{now}',
|
||||
'{hostname}-{now}', # noqa: FS003
|
||||
False,
|
||||
('--glob-archives', 'foo-*'),
|
||||
), # noqa: FS003
|
||||
),
|
||||
(
|
||||
'foo-*',
|
||||
'{hostname}-{now}',
|
||||
'{hostname}-{now}', # noqa: FS003
|
||||
False,
|
||||
('--glob-archives', 'foo-*'),
|
||||
), # noqa: FS003
|
||||
),
|
||||
(
|
||||
None,
|
||||
'{hostname}-docs-{now}', # noqa: FS003
|
||||
|
@ -133,6 +133,18 @@ def test_make_repository_archive_flags_with_borg_features_joins_repository_and_a
|
|||
False,
|
||||
('--glob-archives', '{hostname}-docs-*'), # noqa: FS003
|
||||
),
|
||||
(
|
||||
None,
|
||||
'{now}', # noqa: FS003
|
||||
False,
|
||||
(),
|
||||
),
|
||||
(
|
||||
None,
|
||||
'{now}', # noqa: FS003
|
||||
True,
|
||||
(),
|
||||
),
|
||||
(None, '{utcnow}-docs-{user}', False, ('--glob-archives', '*-docs-{user}')), # noqa: FS003
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue