Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Understanding Racy Git Handling in JGit: detection of coarse timers

In GitIndex.Entry.ismodified() there is a detection for
filesystem-timer resolution. This detection looks weird to us. That's
the code:

			// Git under windows only stores seconds so we round the timestamp
			// Java gives us if it looks like the timestamp in index is seconds
			// only. Otherwise we compare the timestamp at millisecond prevision.
			long javamtime = mtime / 1000000L;
			long lastm = file.lastModified();
			if (javamtime % 1000 == 0)
				lastm = lastm - lastm % 1000;
			if (lastm != javamtime) {
				if (!forceContentCheck)

It is not clear to us:

- why this works
  Filesystem-timers could be coarse but not report constant, non-null
milliseconds. Or granularity could be split-seconds.

- why it is needed
  in which use cases do we compare timestamps which come from timers
with different granularity?

Matthias & Chris

Back to the top