From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: junkio@cox.net
Cc: git@vger.kernel.org, spearce@spearce.org,
Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [PATCH 1/2] Silence diffs due to use by non-C code.
Date: Sun, 26 Apr 2009 14:06:19 +0200 [thread overview]
Message-ID: <1240747579-13843-1-git-send-email-robin.rosenberg@dewire.com> (raw)
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
next prev parent reply other threads:[~2009-04-26 12:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-26 10:55 [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Robin Rosenberg
2009-04-26 11:06 ` Robin Rosenberg
2009-04-26 12:06 ` Robin Rosenberg [this message]
2009-04-26 18:38 ` Junio C Hamano
2009-04-26 19:25 ` Linus Torvalds
2009-04-26 22:02 ` Robin Rosenberg
2009-04-27 6:55 ` Junio C Hamano
2009-04-27 15:00 ` Linus Torvalds
2009-04-27 15:58 ` Kjetil Barvik
2010-03-14 20:51 ` Robin Rosenberg
2010-03-15 6:50 ` Junio C Hamano
2010-03-15 7:41 ` Alex Riesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1240747579-13843-1-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).