On Sat, Jun 27, 2015 at 10:02 PM, Christian Couder
<christian.cou...@gmail.com> wrote:
> On Thu, Jun 25, 2015 at 1:43 PM, Karthik Nayak <karthik....@gmail.com> wrote:
>
>> +                       if (starts_with(formatp, "lalign")) {
>> +                               const char *valp;
>> +                               int val;
>> +
>> +                               skip_prefix(formatp, "lalign", &valp);
>> +                               val = atoi(valp);
>
> After thinking about such code, I wonder if it would be better to
> support %(refname:lalign=X) instead of %(refname:lalignX).
>
> The reason why it might be interesting to require an = sign between
> "align" and the number X is that if we later want to introduce another
> option with a name that starts with "lalign", for example
> %(refname:lalignall=X) that would truncate the refname if it is bigger
> than X), we might be more backward compatible with old git versions
> that implement %(refname:lalign=X) but not %(refname:lalignall=X).
>
> We will be more backward compatible because the above call to
> starts_with() would probably be something like:
>
>                        if (starts_with(formatp, "lalign=")) {
>
> which means that old git versions would ignore something like "lalignall=X".

Another reason is that it would be simpler if we ever want to have
arbitrary string parameters, like %(refname:substitute=%/%\%).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to