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

[PATCH 1/2] Silence diffs due to use by non-C code.

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Apr 26, 2009, 12:06 UTC
Message-ID
<1240747579-13843-1-git-send-email-robin.rosenberg@dewire.com>
In-Reply-To
<200904261306.15448.robin.rosenberg.lists@dewire.com>
In particular, some of the stat info, is not available to Java programs.
JGit sets the uid, gid, dev and ino to all ones to indicate this. Recognose
this special value and ignore changes in those values when the on-disk
value has all bits set.
---
 read-cache.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

This patch is needed for previous one to apply. This approach to silencing index stats diff when JGit has been used does not require special options and one could perhaps argue that any other language without portable access to these fields should set the fields just like JGit does.

The the flag approach is selected, then these patches should be squashed together.

diff --git a/read-cache.c b/read-cache.c
index 3f58711..45083ab 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -210,10 +210,10 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		changed |= CTIME_CHANGED;
 #endif
 
-	if (ce->ce_uid != (unsigned int) st->st_uid ||
-	    ce->ce_gid != (unsigned int) st->st_gid)
+	if ((ce->ce_uid != ~0u && ce->ce_uid != (unsigned int) st->st_uid) ||
+	    (ce->ce_gid != ~0u && ce->ce_gid != (unsigned int) st->st_gid))
 		changed |= OWNER_CHANGED;
-	if (ce->ce_ino != (unsigned int) st->st_ino)
+	if (ce->ce_ino != ~0u && ce->ce_ino != (unsigned int) st->st_ino)
 		changed |= INODE_CHANGED;
 
 #ifdef USE_STDEV
@@ -222,7 +222,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	 * clients will have different views of what "device"
 	 * the filesystem is on
 	 */
-	if (ce->ce_dev != (unsigned int) st->st_dev)
+	if (ce->ce_dev != ~0u && ce->ce_dev != (unsigned int) st->st_dev)
 		changed |= INODE_CHANGED;
 #endif
 
-- 
1.6.3.rc2.1.g4f9e8.dirty
Previous: Robin RosenbergNext: Junio C Hamano
Message 3 of 12 in “Add core.trustlowlevelstat for diffs in dev,ino,uid and gid”
  1. Add core.trustlowlevelstat for diffs in dev,ino,uid and gidRobin Rosenberg, Apr 26, 2009
  2. Robin RosenbergApr 26, 2009
  3. 1/2 Silence diffs due to use by non-C code.Robin Rosenberg, Apr 26, 2009
  4. Junio C HamanoApr 26, 2009
  5. Linus TorvaldsApr 26, 2009
  6. Robin RosenbergApr 26, 2009
  7. Junio C HamanoApr 27, 2009
  8. Linus TorvaldsApr 27, 2009
  9. Kjetil BarvikApr 27, 2009
  10. Robin RosenbergMar 14, 2010
  11. Junio C HamanoMar 15, 2010
  12. Alex RiesenMar 15, 2010

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.