From: Robin Rosenberg Date: Sun, 15 Aug 2010 09:53:42 +0000 (+0200) Subject: Do not trigger RefsChangedEvent on the first attempt to read a ref X-Git-Tag: v0.9.1~121 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a85c08e1c8542be8078b5515b7c1f6336410062b;p=jgit.git Do not trigger RefsChangedEvent on the first attempt to read a ref Such events make no sense, it has never been visible to this process so no client can have a stale value of the ref. Change-Id: Iea3a5035b0a1410b80b09cf53387b22b78b18018 Signed-off-by: Robin Rosenberg --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java index b22b14a910..0f073b66fd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java @@ -851,7 +851,7 @@ public class RefDirectory extends RefDatabase { private void fireRefsChanged() { final int last = lastNotifiedModCnt.get(); final int curr = modCnt.get(); - if (last != curr && lastNotifiedModCnt.compareAndSet(last, curr)) + if (last != curr && lastNotifiedModCnt.compareAndSet(last, curr) && last != 0) parent.fireEvent(new RefsChangedEvent()); }