At least JGit does sets uid, gid, ctime, ino and dev fields to zero on update. To Git this looks like the stat data does not match and a full file compare will be forced even it size and mtime match. This is in practice unnecessary. Sense JGit's presence by checking if ino and dev is zero. Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- read-cache.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/read-cache.c b/read-cache.c index fda78bc..6f13a22 100644 --- a/read-cache.c +++ b/read-cache.c @@ -197,21 +197,26 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) } if (ce->ce_mtime.sec != (unsigned int)st->st_mtime) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.sec != (unsigned int)st->st_ctime) + + int minimal_stat = (ce->ce_ino == 0 && ce->ce_dev == 0); + + if (trust_ctime && !minimal_stat && ce->ce_ctime.sec != (unsigned int)st->st_ctime) changed |= CTIME_CHANGED; #ifdef USE_NSEC if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) + if (trust_ctime && !minimal_stat && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) changed |= CTIME_CHANGED; #endif - 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) - changed |= INODE_CHANGED; + if (!minimal_stat) { + if (ce->ce_uid != (unsigned int) st->st_uid || + ce->ce_gid != (unsigned int) st->st_gid) + changed |= OWNER_CHANGED; + if (ce->ce_ino != 0 && ce->ce_ino != (unsigned int) st->st_ino) + changed |= INODE_CHANGED; + } #ifdef USE_STDEV /* @@ -219,7 +224,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 (!minimal_stat && ce->ce_dev != (unsigned int) st->st_dev) changed |= INODE_CHANGED; #endif -- 1.8.0.msysgit.0.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html