Re: [RFC/PATCH 06/11] branch: roll show_detached HEAD into regular ref_list
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jul 29, 2015, 09:56 UTC
- Message-ID
- <vpqwpxjmgnc.fsf@anie.imag.fr>
- In-Reply-To
- <CAOLa=ZR4DSzdnR8+3eiVTCX92aeFu2o6=iDm7QpdOewizSuxng@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 25 quoted lines
> On Tue, Jul 28, 2015 at 6:31 PM, Matthieu Moy
> <Matthieu.Moy@grenoble-inp.fr> wrote:
>>
>>> -static void show_detached(struct ref_list *ref_list, int maxwidth)
>>> -{
>>> - struct commit *head_commit = lookup_commit_reference_gently(head_sha1, 1);
>>> -
>>> - if (head_commit && is_descendant_of(head_commit, ref_list->with_commit)) {
>>
>> I'm not sure what this if was doing, and why you can get rid of it. My
>> understanding is that with_commit comes from --contains, and in the
>> previous code the filtering was done at display time (detached HEAD was
>> not shown if it was not contained in commits specified with --contains).
>>
>> Eventually, you'll use ref-filter to do this filtering so you won't need
>> this check at display time.
>>
>> But am I correct that for a few commits, you ignore --contains on
>> detached HEAD?
>>
>
> No we don't ignore --contains on detached HEAD.
>
> Since detached HEAD now gets its data from append_ref(). The function
> also checks for the --contains option.Ah, OK. Previously, detached HEAD and branches were completely different, each having its own if (is_descendant_of(...)), and you're now using only one in append_ref() before removing it completely in favor of ref-filter.
That would deserve an explanation for other reviewers I think.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/