git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git for Windows: mingw.c's strange usage of creation time as ctime?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 4, 2017, 02:23 UTC
Message-ID
<20171004022352.GJ19555@aiede.mtv.corp.google.com>
In-Reply-To
<08983090-07d2-cfe4-dd90-ab4887b83893@syntevo.com>

+git-for-windows Hi Marc,

Marc Strapetz wrote:
Show 13 quoted lines
> 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));

Can you say more about the practical effect? Is this causing a bug in practice, is it a bug waiting to happen, or is it making the code difficult to understand without any ill effect expected at run time? (Any of those three is a valuable kind of feedback to offer --- I'm just trying to figure out which one you mean.)

By the way, do you have core.trustctime set to true or false?

Thanks, Jonathan

> -Marc
>
> [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365739(v=vs.85).aspx
Previous: Marc StrapetzNext: Marc Strapetz
Message 2 of 3 in “Git for Windows: mingw.c's strange usage of creation time as ctime?”
  1. Marc StrapetzOct 3, 2017
  2. Jonathan NiederOct 4, 2017
  3. Marc StrapetzOct 4, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.