diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index 85f7e042..f2f23c69 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -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 ()) diff --git a/borgmatic/borg/environment.py b/borgmatic/borg/environment.py index bdadcc30..e975ec04 100644 --- a/borgmatic/borg/environment.py +++ b/borgmatic/borg/environment.py @@ -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, diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 4ddb1358..07beb241 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -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 diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index e85b1479..969b707e 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -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')), diff --git a/tests/unit/borg/test_environment.py b/tests/unit/borg/test_environment.py index f458cf6a..1b49ba7c 100644 --- a/tests/unit/borg/test_environment.py +++ b/tests/unit/borg/test_environment.py @@ -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', }