The following commands init a new repository and performs a backup of a single file.
restic backup
correctly counts files (1) and dirs (4).
restic restore
counts 5 files.
export RESTIC_REPOSITORY=repo
export RESTIC_PASSWORD=test
mkdir {repo,restore}
mkdir -p data/foo/bar/baz
echo foo>data/foo/bar/baz/test
restic init
restic backup data
# Files: 1 new, 0 changed, 0 unmodified
# Dirs: 4 new, 0 changed, 0 unmodified
# Added to the repository: 2.379 KiB (1.931 KiB stored)
#
# processed 1 files, 4 B in 0:00
restic restore -t restore latest
# Summary: Restored 5 Files (4 B) in 0:00
restic restore -t restore latest --json
# {"message_type":"summary","total_files":5,"files_restored":5,"total_bytes":4,"bytes_restored":4}
This is probably because restic treats directories like files, but it’s mildly confusing nevertheless.
Is this a bug or the desired behaviour introduced by #4315 which adjusted the way restic counts to match restic stats
(which only shows total file count)?