Re: [PATCH v15 05/13] ref-filter: implement an `align` atom
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Sep 2, 2015, 15:50 UTC
- Message-ID
- <vpqsi6wom6q.fsf@anie.imag.fr>
- In-Reply-To
- <xmqqd1y0q30g.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 21 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>>>> + } else if (skip_prefix(name, "align", &valp)) {
>>>
>>> This looked as if you are willing to take %(align) in addition to
>>> %(align:...), but...
>>>
>>>> + struct align *align = &v->align;
>>>> + struct strbuf **s;
>>>> +
>>>> + if (valp[0] != ':')
>>>> + die(_("format: usage %%(align:<width>,<position>)"));
>>>
>>> ... apparently that is not what is happening. Why not skip "align:"
>>> with colon as the prefix, then?
>>
>> Cause we wanted to provide an error for usage of "%(ailgn)" without any
>> subvalues as such.
>
> Wouldn't it be something that would be caught in the same codepath
> as what catches %(unrecognized) in the format string?After thinking about it, I agree with Karthik: if we get the same codepath to complain about %(nosuchatom) and %(align), then we won't be able to provide an accurate error message. Or we would need to re-parse the atom, notice that it's one we know about, i.e. redo what we're already doing here.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/