Browse Source

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 <robin.rosenberg@dewire.com>
stable-0.9
Robin Rosenberg 14 years ago committed by Shawn O. Pearce
parent
commit
a85c08e1c8
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java

2
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());
}

Loading…
Cancel
Save