Creating the same .tgz file on different machines
I'm using giternal, which compresses the .git directory of the external references into a .tgz file. Unfortunately, every time I "free开发者_运维百科ze" the external, a new .tgz file is created for the repo.
Even though the contents of the .git directory are the same, a new .tgz file, with diffs, is created. This leads to repo bloat.
Is there a way to cause tar czf to create a .tgz file with exactly the same packaged binary content on different machines?
As the file times, uid and gid are stored alongside the file contents in the tar archive, it's hard to get exactly the same archive. I can only offer a hairy solution like changing the tar file to the common times and uids. ustar interchange format is explained in the POSIX definition of the pax utility. Or you can unpack last and current snapshots and diff them, thus deciding whether they are the same and do you need the last one.
精彩评论