Consider that some Java version on Linux only return integral timestamps

This logic is similar to what we do on Windows, but in this case it's
Java that truncates the timestamps, not Git.

Bug: 395410
Change-Id: Ie55dcb9fa583f5c3dd10d7a1b582e5b04b45858d
This commit is contained in:
Robin Rosenberg 2013-01-05 01:21:07 +01:00
parent 5c49b93191
commit b7d11eace6
1 changed files with 4 additions and 1 deletions

View File

@ -759,7 +759,10 @@ public MetadataDiff compareMetadata(DirCacheEntry entry) {
long fileLastModified = getEntryLastModified();
if (cacheLastModified % 1000 == 0)
fileLastModified = fileLastModified - fileLastModified % 1000;
// Some Java version on Linux return whole seconds only even when
// the file systems supports more precision.
else if (fileLastModified % 1000 == 0)
cacheLastModified = cacheLastModified - cacheLastModified % 1000;
if (fileLastModified != cacheLastModified)
return MetadataDiff.DIFFER_BY_TIMESTAMP;
else if (!entry.isSmudged())