dbsrgits / dbix-class-schema-loader

Official GitHub remote for git.shadowcat.co.uk DBIx-Class-Schema-Loader.git
http://dbix-class.org/
11 stars 34 forks source link

Overwrite if the md5sum in a file is wrong but the content has not changed #8

Closed autarch closed 8 years ago

autarch commented 8 years ago

The code was reading the file, then generating an md5sum for the content and comparing it to the md5sum in the file itself. If these didn't match then it would return the generated MD5 rather than what was actually in the file. It would then compare this generated MD5 to the MD5 for a regen of the same file. If they matched it would not bother writing the file.

This works fine if it's the content that has changed, but if the md5sum itself is wrong but the content has not changed, then returning the generated MD5 based on the content we just read is wrong.

Instead, we now simply return a non-MD5 string. This will force the file to be written again whether it was the file's content that had changed or just its md5sum.

autarch commented 8 years ago

None of the Travis failures seem to have anything to do with my changes.

autarch commented 8 years ago

I just rebased this off the latest master. It'd be great if you could take a look at this. This bug has bitten us at $WORK a few times because of merges that end up changing the md5sum without changing the content.

ilmari commented 8 years ago

Sorry about the slow response. I've had a quick look, and it looks okay (modulo the comment on the test). I'll look at merging it tomorrow.

ilmari commented 8 years ago

Thanks for the fix, and your patience. I've merged it (with minor cleanups to the test) as 348abad.

autarch commented 7 years ago

I'd greatly appreciate it if you could do a release with this fix.

Cheers,

-dave

ilmari commented 7 years ago

Done. Sorry for the delay.

autarch commented 7 years ago

Thanks!