diff options
author | Saša Živkov <sasa.zivkov@sap.com> | 2014-08-05 15:14:59 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-08-28 18:05:59 -0400 |
commit | c4797fe98655b3d52d0a90ba44fce6e053db3b8b (patch) | |
tree | 8120a0caadc4204d6a28e9ab31afa5d3916b39c5 /org.eclipse.jgit/src/org/eclipse/jgit/revwalk | |
parent | 684a2a058ab5454f687af316a6ec562b5538589a (diff) | |
download | jgit-c4797fe98655b3d52d0a90ba44fce6e053db3b8b.tar.gz jgit-c4797fe98655b3d52d0a90ba44fce6e053db3b8b.zip |
Let ObjectWalk.markUninteresting also mark the root tree as
uninteresting
Using the ObjectWalk and marking a commit as uninteresting didn't mark
its root tree as uninteresting. This caused the "missing tree ..."
error in Gerrit under special circumstances. For example, if the
patch-set 2 changes only the commit message then the patch-set 1
and patch-set 2 share the same root-tree:
ps1 -> o o <- ps2
\ /
o root-tree
The transported pack will contain the ps2 commit but not the root-tree
object.
When using the BaseReceivePack.setCheckReferencedObjectsAreReachable
JGit will check the reachability of all referenced objects not provided
in the transported pack. Since the ps1 was advertised it will properly
be marked as uninteresting. However, the root-tree was reachable because
the ObjectWalk.markUninteresting missed to mark it as uninteresting.
JGit was then rejecting the pack with the "missing tree ..." exception.
Gerrit-issue: https://code.google.com/p/gerrit/issues/detail?id=1582
Change-Id: Iff2de8810f14ca304e6655fc8debeb8f3e20712b
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/revwalk')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index 730fde9574..ef96b77c5f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -232,7 +232,7 @@ public class ObjectWalk extends RevWalk { } if (o instanceof RevCommit) - super.markUninteresting((RevCommit) o); + markUninteresting((RevCommit) o); else if (o instanceof RevTree) markTreeUninteresting((RevTree) o); else @@ -243,6 +243,13 @@ public class ObjectWalk extends RevWalk { } @Override + public void markUninteresting(RevCommit c) throws MissingObjectException, + IncorrectObjectTypeException, IOException { + super.markUninteresting(c); + markTreeUninteresting(c.getTree()); + } + + @Override public void sort(RevSort s) { super.sort(s); boundary = hasRevSort(RevSort.BOUNDARY); |