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

Re: [PATCH] pretty: add '*' modifier to add LF after non-empty

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2012, 19:53 UTC
Message-ID
<7v7gzd498r.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1330002637-9347-1-git-send-email-pionchon.luc@gmail.com>
Luc Pionchon <pionchon.luc@gmail.com> writes:
> Add the '*' modifier, similar to the '+' modifier,
> to add a line-feed after a non-empty placeholder.

Hrm, I thought I designed the plus and minus fairly carefully so that nobody needs to add this later.

Wouldn't it be sufficient to write
        Foo%n%-d

that says "We usually have LF after Foo, and write %d after that, but we might not have anything interesting in %d at all, in which case we don't add that %n"?

> +test_expect_success 'add LF after non-empty (1) (empty)' '
> +	git show -s --pretty=format:"%*d%s%nfoo%n" HEAD^^ >actual &&

Shouldn't this be equivalent to "%n%-d%s%nfoo%n", which in turn is covered by one of the previous tests (del LF before empty)?

Previous: Luc PionchonNext: Luc Pionchon
Message 2 of 4 in “pretty: add '*' modifier to add LF after non-empty”
  1. pretty: add '*' modifier to add LF after non-emptyLuc Pionchon, Feb 23, 2012
  2. Junio C HamanoFeb 23, 2012
  3. Luc PionchonFeb 24, 2012
  4. Felipe ContrerasApr 14, 2012

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.