Skip to content

Instantly share code, notes, and snippets.

@kazuki-ma
Created August 2, 2019 01:02
Show Gist options
  • Save kazuki-ma/8549f553c270f88ffd1bf72d3b41239c to your computer and use it in GitHub Desktop.
Save kazuki-ma/8549f553c270f88ffd1bf72d3b41239c to your computer and use it in GitHub Desktop.
- 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