]> source.dussan.org Git - jgit.git/commitdiff
Do not trigger RefsChangedEvent on the first attempt to read a ref 09/1309/2
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 15 Aug 2010 09:53:42 +0000 (11:53 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 18 Aug 2010 23:32:45 +0000 (16:32 -0700)
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 <robin.rosenberg@dewire.com>
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java

index b22b14a91091ddf670df61dcea5de7d0a7157bf4..0f073b66fd2e624bd1473a6632a25126de130f54 100644 (file)
@@ -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());
        }