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

Re: [PATCH] Build configuration to skip ctime for modification test

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 25, 2008, 02:00 UTC
Message-ID
<alpine.LFD.1.10.0807241854580.5249@nehalem.linux-foundation.org>
In-Reply-To
<20080723191647.GF5283@blimp.local>
On Wed, 23 Jul 2008, Alex Riesen wrote:
> 
> It is not that it is broken. We just don't need it, because the st_mode
> is not used, and the rest of inode information is not used anyway.
That is NOT why git checks the ctime.

Git checks the ctime not because it cares about the inode state being modified per se: since it can see that _directly_ - so why should it care about inode state like st_mode?

No, git checks ctime because it in general tries to make it VERY VERY hard for people to try to "fake out" git and replace files from underneath it without git noticing.

It's much easier and much more common for tools to restore 'mtime' when they do some operation on a file than it is for them to restore 'ctime'.

For example, if you rsync files between two hosts, the '-t' flag will make rsync try to keep the mtimes in sync (and it's part of '-a', which is the common form that you'd use for rsync). So if you only look at mtime and size, you often miss the fact that the file has actually been messed with!

Looking at ctime gets around a number of those things. Of course, it can cause git to be _too_ eager in thinking that a file is modified, and an example of that is the insane indexing that 'beagle' does, which actually modifies the files by adding inode extended attributes to them and thus changes ctime due to the indexing. But in general it's a lot better to be too careful than to miss the fact that somebody changed the file.

		Linus
Previous: Alex RiesenNext: Alex Riesen
Message 18 of 41 in “Fix update-index --refresh for submodules if stat(2) returns st_size 0”
  1. Fix update-index --refresh for submodules if stat(2) returns st_size 0Alex Riesen, Jul 21, 2008
  2. Johannes SchindelinJul 21, 2008
  3. Alex RiesenJul 21, 2008
  4. Johannes SchindelinJul 21, 2008
  5. Junio C HamanoJul 22, 2008
  6. Alex RiesenJul 22, 2008
  7. Johannes SixtJul 22, 2008
  8. Alex RiesenJul 22, 2008
  9. Johannes SixtJul 22, 2008
  10. Junio C HamanoJul 22, 2008
  11. Build configuration to skip ctime for modification testAlex Riesen, Jul 22, 2008
  12. Johannes SchindelinJul 22, 2008
  13. Alex RiesenJul 22, 2008
  14. Junio C HamanoJul 23, 2008
  15. Alex RiesenJul 23, 2008
  16. Johannes SchindelinJul 23, 2008
  17. Alex RiesenJul 23, 2008
  18. Linus TorvaldsJul 25, 2008
  19. Alex RiesenJul 25, 2008
  20. Johannes SchindelinJul 26, 2008
  21. Make use of stat.ctime configurableAlex Riesen, Jul 26, 2008
  22. Junio C HamanoJul 27, 2008
  23. Junio C HamanoJul 27, 2008
  24. Make use of stat.ctime configurableAlex Riesen, Jul 28, 2008
  25. David BrownJul 28, 2008
  26. Linus TorvaldsJul 28, 2008
  27. Alex RiesenJul 28, 2008
  28. Junio C HamanoJul 29, 2008
  29. Linus TorvaldsJul 29, 2008
  30. Junio C HamanoJul 29, 2008
  31. David BrownJul 29, 2008
  32. Junio C HamanoJul 29, 2008
  33. Johannes SchindelinJul 29, 2008
  34. Linus TorvaldsJul 29, 2008
  35. Linus TorvaldsJul 29, 2008
  36. Johannes SchindelinJul 29, 2008
  37. Petr BaudisJul 28, 2008
  38. Improve the placement of core.trustctime in the documentationAlex Riesen, Jul 28, 2008
  39. Junio C HamanoJul 29, 2008
  40. Do not use ctime if file mode is not usedAlex Riesen, Jul 24, 2008
  41. git svn throws locale related error when built from sourceAnton Mostovoy, Jul 23, 2008

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.