Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] RevWalk not happy with RevCommit?

I'm trying to walk a commit history to parse some commit messages.  I'm passed in two RevCommits as start and end points.  For some reason, the RevWalk isn't happy with these commits - returns null.  However if I create duplicate RevCommits from the same Object IDs, RevWalk is fine.  I've noticed there are a couple extra flags in the 'bad' versions - is creating new RevCommits the way to go?  Or what am I doing wrong?

String getLog(RevCommit start, RevCommit end, Repository db) {
    RevWalk rw = new RevWalk(db);
    RevCommit a = rw.parseCommit(start.getId());
    RevCommit b = rw.parseCommit(end.getId());
    for(RevCommit c : rw) {
        String msg = c.getFullMessage();

end : commit 339db54924b607eb6657a11dadb5f59de88d1f80 1376329171 -t--sp
b: commit 339db54924b607eb6657a11dadb5f59de88d1f80 1376329171 ----sp

start: commit 5195c009b3b0f9e58fe4b1f4e94d46c6331020e0 1376329090 -tr-sp
a: commit 5195c009b3b0f9e58fe4b1f4e94d46c6331020e0 1376329090 ---usp

Can I make this work with start/end or must I use a/b?


Back to the top