| JGit RevWalk.isMergedInto() [message #1058575] |
Tue, 14 May 2013 09:42  |
Rüdiger Herrmann Messages: 551 Registered: July 2009 |
Senior Member |
|
|
Hi,
I am struggling with RevWalk.isMergedInto(). The two tests below
(should) essentially create the same repository structure:
1. a common ancestor
2. two independent commits (master and topic) with 1. as parent
3. a merge commit of 'master' and 'topic'
4. an 'extra' commit with the merge commit as parent
With this setup, isMergedInto(master, extra) should return true. But for
some reason which I can't figure out, only the first test returns true.
Can anyone point me to what's wrong with the second test?
Both tests require to be members of a class that inherits from
RevWalkTestCase. You may just paste them into the RevWalkMergeBaseTest.
@Test
public void testIsMergedInto1() throws Exception {
RevCommit common = commit();
RevCommit master = commit(common);
RevCommit topic = commit(common);
RevCommit merge = commit(master, topic);
RevCommit extra = commit(merge);
boolean merged = rw.isMergedInto(master, extra);
assertTrue(merged);
}
@Test
public void testIsMergedInto2() throws Exception {
Git git = new Git(db);
git.commit().setMessage("common ancestor").call();
git.branchCreate().setName("topic").call();
RevCommit master = git.commit().setMessage("master commit").call();
git.checkout().setName("topic").call();
git.commit().setMessage("topic commit").call();
git.merge().include(db.getRef("master")).call();
RevCommit extra = git.commit().setMessage("extra commit").call();
boolean merged = rw.isMergedInto(master, extra);
assertTrue(merged);
}
I suspect I am missing something very obvious...
TIA
Rüdiger
|
|
|
|
|
| Re: JGit RevWalk.isMergedInto() [message #1060602 is a reply to message #1060437] |
Mon, 27 May 2013 05:27  |
Stefan Lay Messages: 334 Registered: July 2009 |
Senior Member |
|
|
> I think it is this: Here, and in general, when a method accepts a RevObject of some > kind,
> (and possibly a RevWalk) it means all objects must be allocated by the same RevWalk > instance.
> The javadoc should mention this.
I agree. We should also mention this in the JavaDoc of the Git API methods returning a RevObject.
Stefan
|
|
|
Powered by
FUDForum. Page generated in 0.01610 seconds