* [JGIT PATCH 1/2] Paper bag fix RevWalk.reset after inMergeBase is used
@ 2008-09-16 19:34 Shawn O. Pearce
2008-09-16 19:34 ` [JGIT PATCH 2/2] More aggressively clear flags during RevWalk.reset Shawn O. Pearce
0 siblings, 1 reply; 2+ messages in thread
From: Shawn O. Pearce @ 2008-09-16 19:34 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
We need to remove delayedFreeFlags from carryFlags anytime we
mark those delayedFreeFlags as actually freeFlags. In other
words we do not want to continue carrying a flag which we have
now freed and will recycle for a different use in the future,
one which may not want to be carried automatically onto parent
commits during revision traversal.
I had the boolean expression incorrect (call it a typo). The
correct way to remove set b from a is "a &= ~b" not "a &= b".
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../src/org/spearce/jgit/revwalk/RevWalk.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
index 079432c..5cd7f71 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
@@ -824,7 +824,7 @@ void freeFlag(final int mask) {
private void finishDelayedFreeFlags() {
if (delayFreeFlags != 0) {
freeFlags |= delayFreeFlags;
- carryFlags &= delayFreeFlags;
+ carryFlags &= ~delayFreeFlags;
delayFreeFlags = 0;
}
}
--
1.6.0.2.389.g421e0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [JGIT PATCH 2/2] More aggressively clear flags during RevWalk.reset
2008-09-16 19:34 [JGIT PATCH 1/2] Paper bag fix RevWalk.reset after inMergeBase is used Shawn O. Pearce
@ 2008-09-16 19:34 ` Shawn O. Pearce
0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2008-09-16 19:34 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
We cannot rely upon SEEN to tell us if the commit has flags we
must clear, as some forms of RevWalk usage can get flags put in
places that don't have a clear SEEN trail leading to them. To
ensure we have correctly reset the graph we need to follow down
any chain which has any flag we are not going to retain across
the reset, making the correct test ~retain (and not just SEEN).
This fixes an issue I identified in an application that makes
heavy use of the same RevWalk instance, constantly resetting
it and executing down different parts of the same DAG instance.
Some executions still had UNINTERESTING colored on commits,
even though they should have been cleared by the prior reset.
The clear failed as there was not a SEEN path leading into the
previously UNINTERESTING (but now interesting) commit. This
missing SEEN path occurred because markUninteresting() runs
RevComit.carryFlags(), pushing the UNINTERESTING flag as far
down the DAG as we have parsed. Not all of those DAG nodes
may get visited in a traversal (so they lack SEEN), but they
must get reset in order to reuse the same DAG instance.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../src/org/spearce/jgit/revwalk/RevWalk.java | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
index 5cd7f71..d7e4c58 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
@@ -887,10 +887,11 @@ public final void resetRetain(final RevFlag... retainFlags) {
protected void reset(int retainFlags) {
finishDelayedFreeFlags();
retainFlags |= PARSED;
+ final int clearFlags = ~retainFlags;
final FIFORevQueue q = new FIFORevQueue();
for (final RevCommit c : roots) {
- if ((c.flags & SEEN) == 0)
+ if ((c.flags & clearFlags) == 0)
continue;
c.flags &= retainFlags;
c.reset();
@@ -901,10 +902,13 @@ protected void reset(int retainFlags) {
final RevCommit c = q.next();
if (c == null)
break;
+ if (c.parents == null)
+ continue;
for (final RevCommit p : c.parents) {
- if ((p.flags & SEEN) == 0)
+ if ((p.flags & clearFlags) == 0)
continue;
p.flags &= retainFlags;
+ p.reset();
q.add(p);
}
}
--
1.6.0.2.389.g421e0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-16 19:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 19:34 [JGIT PATCH 1/2] Paper bag fix RevWalk.reset after inMergeBase is used Shawn O. Pearce
2008-09-16 19:34 ` [JGIT PATCH 2/2] More aggressively clear flags during RevWalk.reset Shawn O. Pearce
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).