git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH] Handle the case when the file timestamp in java is rounded to seconds
Date: Mon, 13 Apr 2009 22:45:00 +0200	[thread overview]
Message-ID: <1239655500-13595-1-git-send-email-robin.rosenberg@dewire.com> (raw)

Even if the file systems support subsecond timestamp resolution
the Java runtime, including the Eclipse resources may return
timestamps that are truncated to seconds only.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../decorators/DecoratableResourceAdapter.java     |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
index 5c68d5b..12f7ec3 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
@@ -354,8 +354,12 @@ private static boolean timestampMatches(DirCacheEntry indexEntry,
 		// so we need to check to see if this is the case here, and possibly
 		// fix the timestamp of the resource to match the resolution of the
 		// index.
-		if (tIndex % 1000 == 0) {
-			return tIndex == (tWorkspaceResource - (tWorkspaceResource % 1000));
+		// It also appears the timestamp in Java on Linux may also be rounded
+		// in which case the index timestamp may have subseconds, but not
+		// the timestamp from the workspace resource.
+		// If either timestamp looks rounded we skip the subscond part.
+		if (tIndex % 1000 == 0 || tWorkspaceResource % 1000 == 0) {
+			return tIndex / 1000 == tWorkspaceResource / 1000;
 		} else {
 			return tIndex == tWorkspaceResource;
 		}
-- 
1.6.2.2.446.gfbdc0

                 reply	other threads:[~2009-04-13 20:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239655500-13595-1-git-send-email-robin.rosenberg@dewire.com \
    --to=robin.rosenberg@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).