Add "files_changed" and "msgpack_version_check" options (#1175).

Reviewed-on: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls/1272
This commit is contained in:
Dan Helfman
2026-02-28 07:19:55 +00:00
5 changed files with 23 additions and 6 deletions
+2
View File
@@ -198,6 +198,7 @@ def make_base_create_command( # noqa: PLR0912
umask = config.get('umask', None)
lock_wait = config.get('lock_wait', None)
list_filter_flags = flags.make_list_filter_flags(local_borg_version, dry_run)
files_changed = config.get('files_changed')
files_cache = config.get('files_cache')
archive_name_format = (
config.get('archive_name_format', flags.get_default_archive_name_format(local_borg_version))
@@ -248,6 +249,7 @@ def make_base_create_command( # noqa: PLR0912
+ (('--nobirthtime',) if config.get('birthtime') is False else ())
+ (('--read-special',) if config.get('read_special') or stream_processes else ())
+ noflags_flags
+ (('--files-changed', files_changed) if files_changed else ())
+ (('--files-cache', files_cache) if files_cache else ())
+ (('--remote-path', remote_path) if remote_path else ())
+ (('--umask', str(umask)) if umask else ())
+3 -1
View File
@@ -25,6 +25,7 @@ DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE = {
'relocated_repo_access_is_ok': 'BORG_RELOCATED_REPO_ACCESS_IS_OK',
'unknown_unencrypted_repo_access_is_ok': 'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK',
'use_chunks_archive': 'BORG_USE_CHUNKS_ARCHIVE',
'msgpack_version_check': 'BORG_MSGPACK_VERSION_CHECK',
}
@@ -90,7 +91,8 @@ def make_environment(config):
) in DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE.items():
if os.environ.get(environment_variable_name) is None:
value = config.get(option_name)
environment[environment_variable_name] = 'YES' if value else 'NO'
if value is not None:
environment[environment_variable_name] = 'YES' if value else 'NO'
for (
option_name,
+15
View File
@@ -166,6 +166,15 @@ properties:
Record filesystem flags (e.g. NODUMP, IMMUTABLE) in archive.
Defaults to true.
example: false
files_changed:
type: string
enum: ['ctime', 'mtime', 'disabled']
description: |
Threshold for considering a file as changed. See
https://borgbackup.readthedocs.io/en/stable/usage/create.html for
details. Defaults to "ctime" (i.e., a file is considered
changed if its ctime has changed since the last backup).
example: ctime
files_cache:
type: string
description: |
@@ -562,6 +571,12 @@ properties:
Bypass Borg confirmation about check with repair option. Defaults to
false and an interactive prompt from Borg.
example: true
msgpack_version_check:
type: boolean
description: |
Optionally disable the msgpack version check.
Default is true; use at your own risk.
example: true
extra_borg_options:
type: object
additionalProperties: false
+1
View File
@@ -482,6 +482,7 @@ def test_make_base_create_command_with_store_config_false_omits_config_files():
('flags', True, False, ()),
('flags', False, True, ('--noflags',)),
('flags', False, False, ('--nobsdflags',)),
('files_changed', 'mtime', True, ('--files-changed', 'mtime')),
('files_cache', 'ctime,size', True, ('--files-cache', 'ctime,size')),
('umask', 740, True, ('--umask', '740')),
('lock_wait', 5, True, ('--lock-wait', '5')),
+2 -5
View File
@@ -90,11 +90,6 @@ def test_make_environment_without_configuration_sets_certain_environment_variabl
assert environment == {
'USER': 'root',
'BORG_EXIT_CODES': 'modern',
'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'NO',
'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK': 'NO',
'BORG_USE_CHUNKS_ARCHIVE': 'NO',
'BORG_DEBUG_PASSPHRASE': 'NO',
'BORG_DISPLAY_PASSPHRASE': 'NO',
}
@@ -107,6 +102,7 @@ def test_make_environment_without_configuration_passes_through_default_environme
'BORG_USE_CHUNKS_ARCHIVE': 'yup',
'BORG_DEBUG_PASSPHRASE': 'nah',
'BORG_DISPLAY_PASSPHRASE': 'yup',
'BORG_MSGPACK_VERSION_CHECK': 'yup',
},
)
flexmock(module.borgmatic.hooks.credential.parse).should_receive(
@@ -122,6 +118,7 @@ def test_make_environment_without_configuration_passes_through_default_environme
'BORG_USE_CHUNKS_ARCHIVE': 'yup',
'BORG_DEBUG_PASSPHRASE': 'nah',
'BORG_DISPLAY_PASSPHRASE': 'yup',
'BORG_MSGPACK_VERSION_CHECK': 'yup',
'BORG_EXIT_CODES': 'modern',
}