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

[PATCH] Do not use ctime if file mode is not used

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 24, 2008, 19:00 UTC
Message-ID
<20080724190056.GA3677@blimp.local>
In-Reply-To
<7vr69lihkt.fsf@gitster.siamese.dyndns.org>

On some file systems, the only part of inode information we need (executable) cannot be used, so ctime can be ignored as well. Change time is updated when file attributes were changed (or it is written to, but in this case, mtime is updated as well).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
Junio C Hamano, Wed, Jul 23, 2008 02:12:50 +0200:
Show 6 quoted lines
> > I had that at first (NO_DEPENDABLE_CTIME, than IGNORE_CTIME), than
> > deemed it excessive.
> 
> Why is it excessive?  My initial reaction was "what does trustable
> filemode nor trust_executable_bit has anything to do with ctime".  Please
> explain.

You know, you have a good point... (and I'm sometimes really stupid) Of course it depends on the underlying filesystem!

The updated patch is untested yet, but should be obviously correct.

BTW, any idea how to check if all callers of ce_match_stat_basic have read the configuration? It is not that essential to have trust_executable_bit set correctly, though. In worst case an index entry will be marked not up-to-date.

 read-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index a50a851..f2fa0d9 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -181,7 +181,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	}
 	if (ce->ce_mtime != (unsigned int) st->st_mtime)
 		changed |= MTIME_CHANGED;
-	if (ce->ce_ctime != (unsigned int) st->st_ctime)
+	if (trust_executable_bit && ce->ce_ctime != (unsigned int) st->st_ctime)
 		changed |= CTIME_CHANGED;
 
 	if (ce->ce_uid != (unsigned int) st->st_uid ||
-- 
1.6.0.rc0.70.g5aae9
Previous: Junio C HamanoNext: Anton Mostovoy
Message 40 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.