I have the same issue when leaving a trailing slash ( / ) when backing up my home directory. The ruby command shows the only difference as the trailing slash when using ~/ instead of $HOME.
It may be unrelated, but I’ve noticed that if you leave a trailing forward-slash ‘/’ on the end of the backup directory, restic appears to try to backup each file once again ( or at least reports it as a new file in the summary with -v ).
The following seems to reproduce this behaviour ( You can make $BASE pretty much anything you want, but just note this will make 100 small files, so it should probably be on temporary storage. Also make sure not to use a trailing slash ‘/’ in BASE ):
export BASE=/tmp/test-restic
mkdir $BASE $BASE-back
export RESTIC_REPOSITORY=$BASE-back
for j in {1..100}; do \
echo $j > $BASE/$j; \
done;
restic init
restic backup -v $BASE; # Works as Expected - Discovers 100 new files
restic backup -v $BASE; # Works as Expected - Discovers 0 new files/changes
restic backup -v $BASE/; # Note the trailing '/' - Discovers 100 new files...?
restic backup -v $BASE/; # Note the trailing '/' - Discovers 100 new files again...?
This gives the following output for the restic backup
commands:
Fine ( Initial Backup, without the trailing / ):
...
Files: 100 new, 0 changed, 0 unmodified
Dirs: 1 new, 0 changed, 0 unmodified
Added: 1.010 KiB
snapshot ecbb2088 saved
Fine ( Second Backup, without the trailing / ):
...
Files: 0 new, 0 changed, 100 unmodified
Dirs: 0 new, 0 changed, 1 unmodified
Added: 0 B
snapshot 9f741c05 saved
Weird ( Third Backup, with the trailing / ):
Files: 100 new, 0 changed, 0 unmodified
Dirs: 1 new, 0 changed, 0 unmodified
Added: 0 B
snapshot 98a4e397 saved
The Fourth restic backup ( with the trailing ‘/’ again ) shows the 100 new files again.
The same is true if there are subdirectories as well, each file is considered new.
Sorry for the long post. Thanks for restic though, looks awesome!
Hope this helps,
jedi453