Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] RefDirectory bug?

On Tue, Feb 8, 2011 at 06:06, Marc Strapetz <marc.strapetz@xxxxxxxxxxx> wrote:
> I have a repository, for which a certain, valid ref is not reported.
> AFAIU, the reason is following code in RefDirectory.getRefs():
>
> if (ref != null && ref.getObjectId() != null) {
>        symbolic.set(idx, ref);
>        idx++;
> } else {
>        // A broken symbolic reference, we have to drop it from the
>        // collections the client is about to receive. Should be a
>        // rare occurrence so pay a copy penalty.
>        loose = loose.remove(idx);
>        symbolic.remove(idx);
> }
>
> In the else-part, a broken ref is removed from loose with an idx
> belonging to symbolic. I couldn't figure out whether there is such a
> relation between both lists, however this line seems to be responsible
> for removing my (valid) ref.

Ouch.  I agree, the code is wrong.

I noticed this block when I wrote the RefDatabase implementation for
the DHT code, and wondered if it was right or not... because it didn't
look right.  Its apparently not right.  :-)

You can look at the DhtRefDatabase implementation my RFC patch to see
if I did something different there, I think I did because I think I
borrowed this block and then modified it.

-- 
Shawn.


Back to the top