Why does Zipping the same content twice gives two files with different SHA1?

前端 未结 4 483
失恋的感觉
失恋的感觉 2021-01-03 21:11

I have run into a strange problem with git and zip files. My build script takes a bunch of documentation html pages and zips them into a docs.zip I then check this file into

4条回答
  •  太阳男子
    2021-01-03 21:52

    According to Wikipedia http://en.wikipedia.org/wiki/Zip_(file_format) seems that zip files have headers for File last modification time and File last modification date so any zip file checked into git will appear to git to have changed if the zip is rebuilt from the same content since. And it seems that there is no flag to tell it to not set those headers.

    I am resorting to just using tar, it seems to produce the same bytes for the same input if run multiple times.

提交回复
热议问题