Bug 3229 - Don't make backup file if destination file wasn't modified
Don't make backup file if destination file wasn't modified
Product: rsync
Classification: Unclassified
Component: core
All Linux
: P3 enhancement
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on: 5583
  Show dependency treegraph
Reported: 2005-10-31 12:56 UTC by Ahmon Dancy
Modified: 2009-11-12 22:35 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ahmon Dancy 2005-10-31 12:56:59 UTC
Enhancement request.  I would like a modifier to the -b option that prevents
backup files from being created if the corresponding destination file was not
actually modified.
Comment 1 Wayne Davison 2005-11-01 10:10:18 UTC
Just to be clear: rsync already avoids files that it didn't transfer.  If you
aren't preserving timestamps (-t), rsync will update files that haven't really
changed (because their modified times differ).  You can use the -c (--checksum)
option as one (expensive) way to avoid re-sending files that have not changed
their data, but do not match in modified time.

However, you may be suggesting that rsync be able to check if the updated file
that it just created was created a 100% match of the local file's data.  In that
case, it should be possible to go ahead and skip the backup step (as long as
--inplace wasn't specified).  We might not even need an option for this (though
I'd need to think about the ramifications of that).
Comment 2 Matej Ondrusek 2009-06-29 00:49:40 UTC
I agree with this. The new option should be named --backup-ignore-existing and will prevent overwriting backup file if it already exist (from previous run(s) of rsync). 
Comment 3 Matt McCutchen 2009-11-12 22:35:18 UTC
The post-transfer identical-data check is tracked in bug 5583.