copy-files.sh: Preserve bit-exactness of git-*.exe for DONT_REMOVE_BUILTINS
commit0a318d71d94475ae82127a7ff7e849f3c5c86260
authorKirill Smelkov <kirr@mns.spb.ru>
Mon, 29 Apr 2013 08:19:28 +0000 (29 12:19 +0400)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 29 Apr 2013 20:01:23 +0000 (29 15:01 -0500)
treea7ffb9405e96155f0a20afe2e895a6006d87e0ca
parent907705ee1f68e858f1db04b92a176c9954a0b91f
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>
share/WinGit/copy-files.sh