copy-files.sh: Preserve bit-exactness of git-*.exe for DONT_REMOVE_BUILTINS
Currently, if client (i.e. share/WinGit/portable-release.sh) asks
copy-files.sh not to remove git builtins, we just keep them in bin/ and
libexec/git-core/ . The problem is, later, when those executables are
stripped, though initially they were identical, they all become
different, because:
For PE, strip (and everything from binutils) puts current time into
produced object in PE header into TimeDateStamp [1]:
---- 8< ---- bfd/peXXigen.c
H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
and that hurts, if later a user wants to hardlink'ify portable git
install.
Though strip has --preserve-dates, as said above, it does not affect the
_contents_ of the generated object file - only mtime/ctime are
preserved.
Let's preserve builtins ourselves - we already keep list of them in
etc/fileList-builtins.txt for msysgit installer (it relinks them at
install time), and for portable version, lets first remove all builtins
except git.exe, then strip, and then restore builtins bit-to-bit equal
to git.exe . This way, later hardlinkifying will work.
[1] http://www.csn.ul.ie/~caolan/publink/winresdump/winresdump/doc/pefile2.html
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>