Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] ObjectWalk works only with "self created commit object's"

All the RevWalk classes require that the commits passed to markStart()
be created by that walk object--see the documentation for the 'c'
parameter in the markStart() method.  If you have a commit from a
different walker, pass it to walk.parseCommit(), and it will re-parse
it into a commit that can be used by that walker.

--Matt

On Sat, Jul 31, 2010 at 9:58 AM, Dariusz Luksza
<dariusz.luksza@xxxxxxxxx> wrote:
> Hi all,
>
> ObjectWalk does not contains any elements when in markStart() method
> we use RevCommit object that was created by another walker eg.
> RevWalk.
>
> Example code:
>
> RevWalk rw = new RevWalk(repo);
> RevCommit rwCommit = rw.lookupCommit(commitId);
>
> ObjectWalk ow = new ObjectWalk(repo);
> RevCommit owCommit = ow.lookupCommit(commitId);
>
> ow.markStart(rwCommit);
>
> if (ow.next())
>    System.out.println("rwCommit: OK");
>
> ow.reset();
> ow.markStart(owCommit)
>
> if (ow.next())
>    System.out.println("owCommit: OK");
>
>
> This (pseudo)code will return only: owCommit OK. Additionally
> rwCommit.equals(owCommit) will return false, but both commit objects
> has same SHA-1 id. This seams to be an incorrect behavior ... or I'm
> missing something here.
>
>
> --
> Best regards
>
> GSM: +48 695 192 160
> Blog: http://luksza.org
> LinkedIn: http://www.linkedin.com/in/dariuszluksza
> _______________________________________________
> jgit-dev mailing list
> jgit-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jgit-dev
>


Back to the top