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

Re: [PATCH] for-each-ref: add split message parts to %(contents:*).

From
Michał Górny <mgorny@gentoo.org>
Date
Sep 2, 2011, 17:39 UTC
Message-ID
<20110902193931.42593338@pomiocik.lan>
In-Reply-To
<20110902163903.GA21768@sigill.intra.peff.net>

On Fri, 2 Sep 2011 12:39:03 -0400 Jeff King <peff@peff.net> wrote:

Show 32 quoted lines
> On Thu, Sep 01, 2011 at 06:50:01PM +0200, Michał Górny wrote:
> 
> > -	buf = strchr(buf, '\n');
> > -	if (!buf) {
> > -		*body = "";
> > -		return; /* no body */
> > -	}
> > -	while (*buf == '\n')
> > -		buf++; /* skip blank between subject and body */
> > -	*body = buf;
> > +	buf = format_subject(NULL, buf, NULL);
> > +
> > +	/* When having a signed tag without body, format_subject()
> > +	 * will start to eat the signature. */
> > +	if (buf > *signature)
> > +		*body = *signature;
> > +	else /* - 1 to get a trailing newline to strip */
> > +		*body = buf - 1;
> 
> This last line is wrong if there is no trailing newline, no? Running
> even the existing tests in t6300 against your new patch, I get:
> 
> expecting success:
>   git for-each-ref --format='%(subject)' refs/heads/master >actual &&
>   test_cmp expected actual
> 
> --- expected    2011-09-02 16:36:38.306058729 +0000
> +++ actual      2011-09-02 16:36:38.318058729 +0000
> @@ -1 +1 @@
> -Initial
> +Initia
> not ok - 28 basic atom: head subject
Any suggestion how to strip trailing newlines?
-- 
Best regards,
Michał Górny
Previous: Jeff KingNext: Jeff King
Message 22 of 32 in “More formatting with 'git tag -l'”
  1. Michał GórnyAug 29, 2011
  2. Jeff KingAug 29, 2011
  3. Michał GórnyAug 29, 2011
  4. Jeff KingAug 29, 2011
  5. Michał GórnyAug 29, 2011
  6. git-for-each-ref: move GPG sigs off %(body) to %(signature).Michał Górny, Aug 30, 2011
  7. Michael J GruberAug 30, 2011
  8. Michał GórnyAug 30, 2011
  9. Jeff KingAug 30, 2011
  10. for-each-ref: add split message parts to %(contents:*).Michał Górny, Aug 31, 2011
  11. Jeff KingAug 31, 2011
  12. 1/2 t7004: factor out gpg setupJeff King, Aug 31, 2011
  13. 2/2 t6300: test new content:* for-each-ref placeholdersJeff King, Aug 31, 2011
  14. Junio C HamanoAug 31, 2011
  15. Jeff KingAug 31, 2011
  16. Michał GórnySep 1, 2011
  17. Junio C HamanoSep 1, 2011
  18. Jeff KingSep 1, 2011
  19. Michał GórnySep 1, 2011
  20. for-each-ref: add split message parts to %(contents:*).Michał Górny, Sep 1, 2011
  21. Jeff KingSep 2, 2011
  22. Michał GórnySep 2, 2011
  23. Jeff KingSep 2, 2011
  24. Jeff KingSep 7, 2011
  25. Michał GórnySep 15, 2011
  26. 1/5 t7004: factor out gpg setupJeff King, Sep 7, 2011
  27. 2/5 t6300: add more body-parsing testsJeff King, Sep 7, 2011
  28. 3/5 for-each-ref: refactor subject and body placeholder parsingJeff King, Sep 7, 2011
  29. 4/5 for-each-ref: handle multiline subjects like --prettyJeff King, Sep 7, 2011
  30. 5/5 for-each-ref: add split message parts to %(contents:*).Jeff King, Sep 7, 2011
  31. Junio C HamanoSep 1, 2011
  32. Jeff KingSep 1, 2011

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.