Created
August 2, 2019 01:02
-
-
Save kazuki-ma/8549f553c270f88ffd1bf72d3b41239c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- if sysStat, ok := originalStat.Sys().(*syscall.Stat_t); ok { | |
- // In case of | |
- // | |
- // * inode is preserved after cloned. (Not available in MacOS) | |
- // * we can recover ctime & atime.. | |
- // | |
- // Git can skip update index step after finished de-dup because file stat is same with index information. | |
- err := os.Chtimes(dstFile, | |
- time.Unix(sysStat.Ctimespec.Sec, sysStat.Ctimespec.Nsec), | |
- time.Unix(sysStat.Atimespec.Sec, sysStat.Atimespec.Nsec)) | |
- if err != nil { | |
- Print("recovering timestamp failed. %s", err) | |
- // This is not critical error but update-index wastes time after this command finished. | |
- } | |
- } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment