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

Re: Git on Windows maps creation time onto changed time

From
Johannes Sixt <j6t@kdbg.org>
Date
Feb 2, 2018, 17:38 UTC
Message-ID
<c1e419ae-feae-5a31-ead6-20b25fa92f85@kdbg.org>
In-Reply-To
<CCB76F06-DBA9-4342-8830-402F8AF9854A@blackthorn-media.com>
Am 02.02.2018 um 00:10 schrieb Keith Goldfarb:
Show 22 quoted lines
> Dear git,
> 
> While tracking down a problem with a filesystem shared by Windows and Ubuntu, I came across the following code in compat/mingw.c (ming_fstat(), also in do_lstat()):
> 
> 	if (GetFileInformationByHandle(fh, &fdata)) {
> 		buf->st_ino = 0;
> 		buf->st_gid = 0;
> 		buf->st_uid = 0;
> 		buf->st_nlink = 1;
> 		buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
> 		buf->st_size = fdata.nFileSizeLow |
> 			(((off_t)fdata.nFileSizeHigh)<<32);
> 		buf->st_dev = buf->st_rdev = 0; /* not used by Git */
> 		buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
> 		buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
> 		buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
> 		return 0;
> 	}
> 
> The assignment of buf->st_ctime doesn’t seem right to me. I
> understand there’s no good choice here, but I think a better choice
> would be to  duplicate the definition used for st_mtime.

The purpose of these values is to allow to notice a change on the file system without going through the actual file data. Duplicating st_mtime would be pointless.

Show 5 quoted lines
> Background: When I do a git status on Windows and then later on
> Ubuntu (or the other order), it is extremely slow, as the entire tree
> is being traversed. I tracked it down to this difference in
> definition of c_time. Yes, I know about the core.trustctime variable,
> but my problem aside  this seems like an unwise choice.
Don't do that then. Use core.trustctime.
-- Hannes
Previous: Ævar Arnfjörð BjarmasonNext: Keith Goldfarb
Message 3 of 7 in “Git on Windows maps creation time onto changed time”
  1. Keith GoldfarbFeb 1, 2018
  2. Ævar Arnfjörð BjarmasonFeb 1, 2018
  3. Johannes SixtFeb 2, 2018
  4. Keith GoldfarbFeb 2, 2018
  5. Johannes SchindelinFeb 2, 2018
  6. Keith GoldfarbFeb 2, 2018
  7. Johannes SchindelinFeb 2, 2018

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.