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

Re: [RFC PATCH] checkout: Force matching mtime between files

From
Jeff King <peff@peff.net>
Date
May 5, 2018, 18:44 UTC
Message-ID
<20180505184426.GA18385@sigill.intra.peff.net>
In-Reply-To
<20180413170129.15310-1-mgorny@gentoo.org>
On Fri, Apr 13, 2018 at 07:01:29PM +0200, Michał Górny wrote:
Show 6 quoted lines
> In order to avoid unnecessary cache mismatches, force a matching mtime
> between all files created by a single checkout action.  This seems to be
> the best course of action.  Matching mtimes do not trigger cache
> updates.  They also match the concept of 'checkout' being an atomic
> action.  Finally, this change does not break backwards compatibility
> as the new result is a subset of the possible previous results.

There's one case that might be regressed. As long as we assume time always moves forward, I think you're right, but...

Show 9 quoted lines
> diff --git a/unpack-trees.c b/unpack-trees.c
> index e73745051..e1efefb68 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -346,6 +346,7 @@ static int check_updates(struct unpack_trees_options *o)
>  	state.quiet = 1;
>  	state.refresh_cache = 1;
>  	state.istate = index;
> +	state.checkout_mtime = time(NULL);

ISTR that it's possible for "system time" to be different from "filesystem time". Is there any case where the time we get from time(NULL) might vary wildly from what would be written by the filesystem if we were to simply write the file? E.g., perhaps on some types of network-mounted filesystems.

The files in your checkout would all be consistent, but they might be inconsistent with other files _not_ created by Git (e.g., one might be saved in your editor). Now you may have introduced skew that cause "make" to do the wrong thing, because your source and target files are really operating from two different clocks.

I really don't know how possible or common this is, but I feel like I've been warned about this distinction in the past. I wouldn't be surprised to find that it's an archaic thing found only on ancient versions of NFS, and oral tradition passed down the warnings. But I also would not be surprised if it's still possible and common.

-Peff
Previous: Michał GórnyNext: Junio C Hamano
Message 34 of 35 in “checkout: Force matching mtime between files”
  1. checkout: Force matching mtime between filesMichał Górny, Apr 13, 2018
  2. Robin H. JohnsonApr 23, 2018
  3. Junio C HamanoApr 23, 2018
  4. Robin H. JohnsonApr 25, 2018
  5. Junio C HamanoApr 25, 2018
  6. Marc BranchaudApr 25, 2018
  7. Robin H. JohnsonApr 25, 2018
  8. Junio C HamanoApr 26, 2018
  9. Marc BranchaudApr 26, 2018
  10. Michał GórnyApr 26, 2018
  11. Duy NguyenApr 28, 2018
  12. Michał GórnyApr 28, 2018
  13. Duy NguyenApr 26, 2018
  14. Robin H. JohnsonApr 26, 2018
  15. Duy NguyenApr 26, 2018
  16. Junio C HamanoApr 29, 2018
  17. Duy NguyenApr 30, 2018
  18. Duy NguyenApr 27, 2018
  19. Elijah NewrenApr 27, 2018
  20. Duy NguyenApr 28, 2018
  21. Junio C HamanoApr 29, 2018
  22. Marc BranchaudApr 27, 2018
  23. Duy NguyenApr 28, 2018
  24. Michał GórnyApr 27, 2018
  25. Ævar Arnfjörð BjarmasonApr 27, 2018
  26. Ævar Arnfjörð BjarmasonApr 25, 2018
  27. Duy NguyenApr 26, 2018
  28. Robin H. JohnsonApr 26, 2018
  29. SZEDER GáborApr 26, 2018
  30. Duy NguyenApr 26, 2018
  31. Marc BranchaudApr 24, 2018
  32. Robin H. JohnsonApr 25, 2018
  33. Michał GórnyApr 25, 2018
  34. Jeff KingMay 5, 2018
  35. Junio C HamanoMay 6, 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.