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

Re: [PATCH v2] pretty: add %D format specifier

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2014, 22:44 UTC
Message-ID
<xmqq7g144i7q.fsf@gitster.dls.corp.google.com>
In-Reply-To
<54175F2D.3070209@exec64.co.uk>
Harry Jeffery <harry@exec64.co.uk> writes:
Show 6 quoted lines
> Add a new format specifier, '%D' that is identical in behaviour to '%d',
> except that it does not include the ' (' prefix or ')' suffix provided
> by '%d'.
>
> Signed-off-by: Harry Jeffery <harry@exec64.co.uk>
> ---

The patch is broken and does not apply with "git am" here. Please first try sending a patch to yourself and make sure it comes through OK.

Thanks.
Show 12 quoted lines
> diff --git a/log-tree.h b/log-tree.h
> index d6ecd4d..b26160c 100644
> --- a/log-tree.h
> +++ b/log-tree.h
> @@ -13,7 +13,13 @@ int log_tree_diff_flush(struct rev_info *);
>  int log_tree_commit(struct rev_info *, struct commit *);
>  int log_tree_opt_parse(struct rev_info *, const char **, int);
>  void show_log(struct rev_info *opt);
> -void format_decorations(struct strbuf *sb, const struct commit
> *commit, int use_color);
> +void format_decorations_extended(struct strbuf *sb, const struct
> commit *commit,
Broken lines...
Show 7 quoted lines
> +			     int use_color,
> +			     const char *prefix,
> +			     const char *separator,
> +			     const char *suffix);
> +#define format_decorations(strbuf, commit, color) \
> +			     format_decorations_extended((strbuf),
> (commit), (color), " (", ", ", ")")
Broken line here, too.
Show 39 quoted lines
>  void show_decorations(struct rev_info *opt, struct commit *commit);
>  void log_write_email_headers(struct rev_info *opt, struct commit *commit,
>  			     const char **subject_p,
> diff --git a/pretty.c b/pretty.c
> index 44b9f64..46d65b9 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -1197,6 +1197,10 @@ static size_t format_commit_one(struct strbuf
> *sb, /* in UTF-8 */
>  		load_ref_decorations(DECORATE_SHORT_REFS);
>  		format_decorations(sb, commit, c->auto_color);
>  		return 1;
> +	case 'D':
> +		load_ref_decorations(DECORATE_SHORT_REFS);
> +		format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
> +		return 1;
>  	case 'g':		/* reflog info */
>  		switch(placeholder[1]) {
>  		case 'd':	/* reflog selector */
> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
> index de0cc4a..38148c1 100755
> --- a/t/t4205-log-pretty-formats.sh
> +++ b/t/t4205-log-pretty-formats.sh
> @@ -457,4 +457,15 @@ EOF
>  	test_cmp expected actual1
>  '
>
> +test_expect_success 'clean log decoration' '
> +	git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
> +	cat <<EOF >expected &&
> +$head1 tag: refs/tags/tag2
> +$head2 tag: refs/tags/message-one
> +$old_head1 tag: refs/tags/message-two
> +EOF
> +	sort actual >actual1 &&
> +	test_cmp expected actual1
> +'
> +
>  test_done
Previous: Harry Jeffery
Message 2 of 2 in “pretty: add %D format specifier”
  1. pretty: add %D format specifierHarry Jeffery, Sep 15, 2014
  2. Junio C HamanoSep 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.