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

Re: [PATCH v14 01/11] trailer: add data structures and basic functions

From
Jeff King <peff@peff.net>
Date
Sep 17, 2014, 07:58 UTC
Message-ID
<20140917075838.GA16200@peff.net>
In-Reply-To
<CAP8UFD3wi2KCZhDAF7vqMpb72DbLMbHNDiDGi0tFLW+vzsQqSA@mail.gmail.com>
On Tue, Sep 16, 2014 at 10:01:11AM +0200, Christian Couder wrote:
Show 10 quoted lines
> On Mon, Sep 15, 2014 at 10:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Christian Couder <chriscool@tuxfamily.org> writes:
> >
> >> +/* Get the length of buf from its beginning until its last alphanumeric character */
> >
> > That makes it sound as if feeding "abc%de#f@" to the function returns
> > 3 for "abc", but
> 
> For me the last alphanumeric character in "abc%de#f@" is "f", so it is
> the length from the beginning to "f" so it should return 8.

FWIW, I parsed the comment as you intended, but I do think it is a bit unclear (especially given the name, as it is skipping over more than just alnums). From reading the calling code, it looks like the intent is to take a token string like "Signed-off-by:" and find that the ":" is part of the ending punctuation, but that the "-" are retained as internal punctuation.

Would it make sense as:
  /*
   * Return the length of the string not including any final
   * punctuation. E.g., the input "Signed-off-by:" would return
   * 13, stripping the trailing punctuation but retaining
   * internal punctuation.
   */
  int token_len_without_separator(const char *token)
  ...

The name is a bit clunky, but hopefully it is more clear what the point is.

-Peff
Previous: Christian CouderNext: Christian Couder
Message 5 of 16 in “Add interpret-trailers builtin”
  1. 00/11 Add interpret-trailers builtinChristian Couder, Sep 15, 2014
  2. 01/11 trailer: add data structures and basic functionsChristian Couder, Sep 15, 2014
  3. Junio C HamanoSep 15, 2014
  4. Christian CouderSep 16, 2014
  5. Jeff KingSep 17, 2014
  6. Christian CouderSep 17, 2014
  7. 02/11 trailer: process trailers from input message and argumentsChristian Couder, Sep 15, 2014
  8. 03/11 trailer: read and process config informationChristian Couder, Sep 15, 2014
  9. 04/11 trailer: process command line trailer argumentsChristian Couder, Sep 15, 2014
  10. 05/11 trailer: parse trailers from file or stdinChristian Couder, Sep 15, 2014
  11. 06/11 trailer: put all the processing together and printChristian Couder, Sep 15, 2014
  12. 07/11 trailer: add interpret-trailers commandChristian Couder, Sep 15, 2014
  13. 08/11 trailer: add tests for "git interpret-trailers"Christian Couder, Sep 15, 2014
  14. 09/11 trailer: execute command from 'trailer.<name>.command'Christian Couder, Sep 15, 2014
  15. 10/11 trailer: add tests for commands in config fileChristian Couder, Sep 15, 2014
  16. 11/11 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Sep 15, 2014

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.