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

Re: Git does not handle changing inode numbers well

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2012, 17:53 UTC
Message-ID
<7vboiltglr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120808152230.GQ21274@login.drsnuggles.stderr.nl>
Matthijs Kooijman <matthijs@stdin.nl> writes:
Show 7 quoted lines
> So, it seems that git just doesn't cope well with changing inode numbers
> because it checks the content in a first pass in refresh_index, but only
> checks the stat info in the second pass in run_diff_files. The reason it
> does work for regular files is EC_UPTODATE optimization introduced in
> eadb5831: Avoid running lstat(2) on the same cache entry.
>
> So, let's see if I can fix my filesystem now ;-)

True. We have knobs to cope with filesystems whose st_dev or st_ctime are not stable, but there is no such knob to tweak for st_ino. Shouldn't be too hard to add such, though. One approach is to do something like the attached patch, and declare, define, initialize, and set trust_inum in a way similar to how we handle trust_ctime in the existing code.

 read-cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/read-cache.c b/read-cache.c
index 2f8159f..6da99af 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -210,7 +210,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	if (ce->ce_uid != (unsigned int) st->st_uid ||
 	    ce->ce_gid != (unsigned int) st->st_gid)
 		changed |= OWNER_CHANGED;
-	if (ce->ce_ino != (unsigned int) st->st_ino)
+	if (trust_inum && ce->ce_ino != (unsigned int) st->st_ino)
 		changed |= INODE_CHANGED;
 
 #ifdef USE_STDEV
Previous: Matthijs KooijmanNext: Matthijs Kooijman
Message 2 of 4 in “Git does not handle changing inode numbers well”
  1. Matthijs KooijmanAug 8, 2012
  2. Junio C HamanoAug 8, 2012
  3. Matthijs KooijmanAug 8, 2012
  4. Matthijs KooijmanAug 8, 2012

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.