jedbrown / git-fat

Simple way to handle fat files without committing them to git, supports synchronization using rsync
BSD 2-Clause "Simplified" License
621 stars 137 forks source link

Add `verify` command to check git-fat object data matches hash filename. #36

Closed jmurty closed 10 years ago

jmurty commented 10 years ago

While experimenting with using the --partial option with rsync I managed to corrupt one of my git-fat objects by truncating it. This caused some behaviour in git-fat which seemed odd until I worked out what had happened: it would check out the truncated data but git would see the file as modified and show the changed hash in a diff, while a re-checkout did not reset the file to its original data/hash.

This commit adds a verify command that cross-checks git-fat object file names (the original SHA1) against the SHA1 of the object's actual data and prints any mismatches. So you can quickly find any dubious objects and decide what to do about them.

A better solution might be to calcuate and verify objects' data hash during filter-smudge/checkout though this would likely hurt performance.