From: Marek Zawirski <marek.zawirski@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Stephen Bannasch <stephen.bannasch@deanbrook.org>,
git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: Re: problem using jgit
Date: Fri, 25 Jul 2008 16:51:58 +0200 [thread overview]
Message-ID: <4889E88E.8000701@gmail.com> (raw)
In-Reply-To: <20080722165831.GA11173@spearce.org>
Shawn O. Pearce wrote:
> Marek Zawirski <marek.zawirski@gmail.com> wrote:
>
>> Marek Zawirski wrote:
>>
>>> Stephen Bannasch wrote:
>>>
>>>> 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.
>>>>
> ...
>
>> 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.
>>
>
> My intention here was that if a ref cannot be resolved, it should
> not be reported. So Ref.getObjectId should never return null, and
> it should also never return an ObjectId for which the object does
> not exist in the Repository's object database(s). (Though that can
> happen in the face of repository corruption, but lets not go there
> just yet).
>
> So IMHO the RefDatabase code is _wrong_ for returning HEAD with a
> null objectId.
>
> Now this case can happen if HEAD points at a stillborn branch. This
> is easily reproduced in any repository, e.g. just do:
>
> git symbolic-ref HEAD refs/heads/`date`
>
> You'll wind up on a branch which doesn't exist. In this case HEAD
> shouldn't be reported back from RefDatabase, it doesn't exist, as
> branch `date` does not exist either.
>
>
Beside of my temporary fix for that that filters null Ref and Ref with
null objectId, I think that 2 more issues may need to be resolved:
1) readRefBasic() method is used for reading arbitrary refs, potentially
not only those from well-known prefixes as readRefs() does. Is calling
setModified() appropriate for those other refs?
2) Am I wrong that setModified() is not called in all cases? Consider
empty ref file and just...
if (line == null || line.length() == 0)
return new Ref(Ref.Storage.LOOSE, name, null);
next prev parent reply other threads:[~2008-07-25 14:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 6:24 problem using jgit Stephen Bannasch
2008-07-21 10:41 ` Marek Zawirski
2008-07-21 12:35 ` Marek Zawirski
2008-07-21 17:36 ` Stephen Bannasch
2008-07-22 11:51 ` Marek Zawirski
2008-07-22 16:58 ` Shawn O. Pearce
2008-07-25 14:51 ` Marek Zawirski [this message]
2008-07-27 3:21 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4889E88E.8000701@gmail.com \
--to=marek.zawirski@gmail.com \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
--cc=spearce@spearce.org \
--cc=stephen.bannasch@deanbrook.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).