Source:
<code>public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; int type = mode & FileMode.TYPE_MASK; if (type == FileMode.TYPE_TREE || type == FileMode.TYPE_GITLINK) return MetadataDiff.EQUAL; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; Instant cacheLastModified = entry.getLastModifiedInstant(); Instant fileLastModified = getEntryLastModifiedInstant(); long cacheSeconds = cacheLastModified.getEpochSecond(); long fileSeconds = fileLastModified.getEpochSecond(); if (cacheSeconds != fileSeconds) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } int cacheSubSecond = cacheLastModified.getNano(); int fileSubSecond = fileLastModified.getNano(); if ((getOptions().getCheckStat() == CheckStat.MINIMAL) || (cacheSubSecond == 0) || (fileSubSecond == 0)) { } else if (cacheSubSecond != fileSubSecond) { <START> if (cacheSubSecond % 1_000_000 == 0) { <END> fileSubSecond -= (fileSubSecond % 1_000_000); if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } if (entry.isSmudged()) { return MetadataDiff.SMUDGED; } return MetadataDiff.EQUAL; }</code><technical_language>whats other side: imagine - cacheSeconds == fileSeconds - cacheSubSecond % 1_000_000 != 0 - fileSubSecond % 1_000_000 == 0 E.g. index written a Java version providing subseconds JVM switched work a JVM filetimestamps coarse. In this case is clear in JVM-switch situation file modtime is older in index savely assume subseconds account. Or</technical_language>

Target:
public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; int type = mode & FileMode.TYPE_MASK; if (type == FileMode.TYPE_TREE || type == FileMode.TYPE_GITLINK) return MetadataDiff.EQUAL; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; Instant cacheLastModified = entry.getLastModifiedInstant(); Instant fileLastModified = getEntryLastModifiedInstant(); long cacheSeconds = cacheLastModified.getEpochSecond(); long fileSeconds = fileLastModified.getEpochSecond(); if (cacheSeconds != fileSeconds) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } int cacheSubSecond = cacheLastModified.getNano(); int fileSubSecond = fileLastModified.getNano(); if ((getOptions().getCheckStat() == CheckStat.MINIMAL) || (cacheSubSecond == 0) || (fileSubSecond == 0)) { } else if (cacheSubSecond != fileSubSecond) { int cacheSubMillis = cacheSubSecond % 1_000_000; int fileSubMillis = fileSubSecond % 1_000_000; if (cacheSubMillis == 0) { fileSubSecond -= fileSubMillis; if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else if (fileSubMillis == 0) { cacheSubSecond -= cacheSubMillis; if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } if (entry.isSmudged()) { return MetadataDiff.SMUDGED; } return MetadataDiff.EQUAL; }