mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
git-commit must allocate a copy of the current index if only a subset of files is to be commited in save_index(). It uses 'cp -p' because the index may contain racily-clean entries, which will be detected only if the timestamp of the index remains unaltered. In general, it is safe to create a hardlink instead of copying the index because all writers use the lock_file infrastructure that writes a new file and moves it into the destination, breaking the hardlink. On Windows, in particular, 'cp -p' suffers from a mysterious inability to accurately preserve the timestamp under some circumstances. (This was detected by the test suite, where some racily clean files were not recognized.) 'ln' does create a hardlink on Windows on NTFS, and makes a copy with the correctly preserved timestamp on FAT. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
14 KiB
Executable File
14 KiB
Executable File