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/config/schema.yaml b/borgmatic/config/schema.yaml index e29c1e58..f339ce0d 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -166,6 +166,14 @@ properties: Record filesystem flags (e.g. NODUMP, IMMUTABLE) in archive. Defaults to true. example: false + files_changed: + type: string + description: | + Threshold for considering a file as changed. See + https://borgbackup.readthedocs.io/en/stable/usage/create.html for + details. Defaults to "mtime" (i.e., a file is considered + changed if its mtime has changed since the last backup). + example: mtime,size files_cache: type: string description: | 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')),