diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2010-10-27 10:37:05 +0200 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2010-10-27 10:52:42 +0200 |
commit | 2c38e5d46155106fa0a0aed2b551207f0e6f2f2a (patch) | |
tree | 4e29cd2b53d2e3081dd26c7d6e6ac4e2c6bdacc9 | |
parent | 07cae6e6c1d6982cf6b919e90e79330793c74a15 (diff) | |
download | jgit-2c38e5d46155106fa0a0aed2b551207f0e6f2f2a.tar.gz jgit-2c38e5d46155106fa0a0aed2b551207f0e6f2f2a.zip |
Prevent endless loop of events fired by RefsDirectory
RefsDirectory fires a RefsChangedEvent when it detect that one
ref changed (new, modified, deleted). But there was a potential
of wrong events beeing fired leading to a endless loop in EGit.
Problem is that when calling getRefs(ALL) we don't want to report
additional refs and by that we remove the additional refs from
the list of "refs reported upwards last time". We fire an
RefsChangedEvent because we think that the special refs are not
there anymore.
I fixed this by removing eventing for the additional refs. Another
alternative would be to always scan also for additional refs and
put them in the list of refs. But getRefs(ALL) would then remove
the additional refs again. I didn't do that for performance reasons
and also because I am not sure whether we want evnting for
additional refs.
Change-Id: Icb9398b55a8c6bbf03e38f6670feb67754ce91e0
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java | 7 |
1 files changed, 7 insertions, 0 deletions
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 2e4489cda4..96c8361adb 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 @@ -800,6 +800,13 @@ public class RefDirectory extends RefDatabase { final LooseRef n = scanRef(null, name); if (n == null) return packed.get(name); + + // check whether the found new ref is the an additional ref. These refs + // should not go into looseRefs + for (int i = 0; i < additionalRefsNames.length; i++) + if (name.equals(additionalRefsNames[i])) + return n; + if (looseRefs.compareAndSet(curList, curList.add(idx, n))) modCnt.incrementAndGet(); return n; |