Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] File timestamp precision on Linux


In WorkingTreeIterator.isModified there is some code for rounding cached
timestamps to seconds, since Java on Windows gives times with a
precision of seconds. However, I'm noticing a similar issue on Linux. 

Java on Linux is returning times rounded to seconds. The problem is that
the C git stores timestamps using millisecond precision. So for example,
if I run "git reset --hard" and then traverse the working tree using a
TreeWalk checking isModified for each item, the date comparison will
almost always fail (milliseconds won't match), leading to many full
content checks, which is much slower.

This issue can be solved in WorkingTreeIterator by rounding the cached
timestamp to seconds when the last write time of the file being checked
is also rounded to seconds. However, I'm wondering if this is a known
issue that it is handled in a different way in other places of the code.


Back to the top