Git for Windows: mingw.c's strange usage of creation time as ctime?
- From
Marc Strapetz <marc.strapetz@syntevo.com>
- Date
- Oct 3, 2017, 22:29 UTC
- Message-ID
- <08983090-07d2-cfe4-dd90-ab4887b83893@syntevo.com>
compat/mingw.c assigns the Windows file creation time [1] to Git's ctime fields at line 591 and at line 705:
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
ftCreationTime > ftLastWriteTime is actually possible after copying a file, so it makes sense to include this timestamp somehow in the Index, but I think it would be better to use the maximum of ftLastWriteTime and ftCreationTime here which is less confusing and closer to Unix's ctime:
buf->st_ctime = max(buf->st_mtime,
filetime_to_time_t(&(fdata.ftCreationTime));-Marc
[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365739(v=vs.85).aspx