Re: problem using jgit
From: Marek Zawirski <hidden>
Date: 2016-06-15 22:44:59
Marek Zawirski wrote:
Stephen Bannasch wrote:quoted
I've setup a simple test class that integrates jgit to clone a git repository. However I'm getting a NullPointerError when RevWalk.parseAny ends up producing a null object id. The code and the stack trace for the error are here: http://pastie.org/237711 This problem occurs using the jgit from the master branch from this repo: git://repo.or.cz/egit.gitHello Stephen, I think you've experienced error caused by the same bug as me, during my latest fetch/push GUI works few days ago. Your code looks fine, probably it's actually bug in jgit. I think it's some regression. Thanks for reporting.
It's caused by 14a630c3: Cached modification times for symbolic refs too Changes introduced by this patch made Repository#getAllRefs() including Ref objects with null ObjectId in case of unresolvable (invalid?) HEAD symbolic ref, and null Ref for HEAD when it doesn't exist. Previous behavior was just not including such refs in result. Fix for null Ref is just a matter of simple filtering out null Ref object for HEAD, if it doesn't exist (just is it considered to be legal state of repository when HEAD doesn't exist?). To fix null ObjectId issue, we have to either change all clients of this method or revert method to previous behavior. Now it's just unspecified in javadoc. Robin, Shawn, what do you think? If we want to have unresolvable refs included, IMO it may be sensible to provide argument includeUnresolbable for Repository#getAllRefs() to let clients avoid burden of filtering them out when they don't need them (most cases, perhaps). I can prepare fix for it (rather easy one) as you are unavailable now, let me now what's your opinion.