git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] Add interpret-trailers builtin

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 5, 2013, 19:09 UTC
Message-ID
<xmqqli12acoh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CALKQrgcweo+B8JKH85-4-SOHsAi6SAxstnXhRWCst_qEyXYmhA@mail.gmail.com>
Johan Herland <johan@herland.net> writes:
Show 26 quoted lines
> On Mon, Nov 4, 2013 at 8:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Johan Herland <johan@herland.net> writes:
>>>> +{
>>>> +       char *end = strchr(arg, '=');
>>>> +       if (!end)
>>>> +               end = strchr(arg, ':');
>>>
>>> So both '=' (preferred) and ':' are accepted as field/value
>>> separators. That's ok for the command-line, I believe.
>>
>> Why?
>>
>> Sometimes you have to be loose from the beginning _if_ some existing
>> uses and established conventions make it easier for the users, but
>> if you do not have to start from being loose, it is almost always a
>> mistake to do so.  The above code just closed the door to use ":"
>> for some other useful purposes we may later discover, and will make
>> us regret for doing so.
>
> Although I agree with the principle, I think there are (at least) two
> established conventions that will be commonly used from the start, and
> that we should support:
>
>  - Using short forms with '=', e.g. "ack=Peff". There is already a
> convention on how we specify <name> + <value> pairs on the command
> line, e.g. "git -c foo=bar ..."
I do not have much problem with this.
>  - Copy-pasting footers from existing commit messages. These will have
> the same format as the expected output of this command, and not
> accepting the same format in its input seems silly, IMHO.
I am not sure about this, but syntactically, it is very similar to
    --message "CC: Johan Herland <j@h.net>"

so probably it is OK, but then we do not even have to limit it to colon, no? E.g. appending an arbitrary footer, with its literal value, may be done with something like:

    --footer "CC: Johan Herland <j@h.net>"
    --footer "Closes #12345"
Show 7 quoted lines
>> Also, there is a distinction between fields with the same field name
>> appearing twice and fields with the same field name and the same
>> field value appearing twice. Some headers do want to have them, some
>> do not.
>
> True. This complexity is partly why I initially wanted to leave this
> whole thing up to hooks, but I guess now we have to deal with it...

If we are adding anything, it has to be able to express what we already do for Signed-off-by: line, so we cannot start from somewhere any simpler than this, I am afraid.

Previous: Christian CouderNext: Junio C Hamano
Message 6 of 13 in “Add interpret-trailers builtin”
  1. Add interpret-trailers builtinChristian Couder, Nov 3, 2013
  2. Johan HerlandNov 4, 2013
  3. Junio C HamanoNov 4, 2013
  4. Johan HerlandNov 5, 2013
  5. Christian CouderNov 5, 2013
  6. Junio C HamanoNov 5, 2013
  7. Junio C HamanoNov 4, 2013
  8. Christian CouderNov 6, 2013
  9. Christian CouderNov 6, 2013
  10. Junio C HamanoNov 6, 2013
  11. Christian CouderNov 6, 2013
  12. Junio C HamanoNov 6, 2013
  13. Christian CouderNov 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.