The snapshot file contains a.txt
on the first tar command.
On the second tar the snapshot does not know about b.txt
. a.txt
has not changed so the incremental archive is empty.
If the incremental archive is at directory level, it will detect the change (b.txt) because b.txt exists within the directory's heirarchy.
If the snapshot file exists, it determines which files are modified.
See GNU Tar reference incremental backups
The option ‘--listed-incremental’ instructs tar to operate on an
incremental archive with additional metadata stored in a standalone
file, called a snapshot file. The purpose of this file is to help
determine which files have been changed, added or deleted since the
last backup, so that the next incremental backup will contain only
modified files. The name of the snapshot file is given as an argument
to the option: