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

Re: [PATCH] reflog: specify default pretty format in config

From
Matthieu Moy <git@matthieu-moy.fr>
Date
Jan 30, 2019, 18:22 UTC
Message-ID
<361643257.4118832.1548872569575.JavaMail.zimbra@matthieu-moy.fr>
In-Reply-To
<20190130144744.3248-1-rhi@pengutronix.de>
Roland Hieber <rhi@pengutronix.de> writes:
> The output of git-reflog is currently only customizable by calling
> reflog with --pretty=... or overriding the default "oneline" pretty
> format in the configuration.
Sounds like a good idea to me, but the patch needs a bit more work:
>  Documentation/git-reflog.txt |  2 ++

It's nice to refer to the config variable in git-reflog.txt, but you should also document it in some Documentation/config/*.txt file, included from Documentation/config.txt, so that it appears in man git-config.

>  builtin/log.c                | 12 +++++++++---
>  2 files changed, 11 insertions(+), 3 deletions(-)
This lacks tests, too (t/*.sh).
Show 21 quoted lines
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -667,6 +667,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
>  {
>  	struct rev_info rev;
>  	struct setup_revision_opt opt;
> +	int cfg_have_pretty;
>  
>  	init_log_defaults();
>  	git_config(git_log_config, NULL);
> @@ -676,11 +677,16 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
>  	rev.verbose_header = 1;
>  	memset(&opt, 0, sizeof(opt));
>  	opt.def = "HEAD";
> +
> +	cfg_have_pretty = git_config_get_string_const("reflog.pretty", &fmt_pretty);
>  	cmd_log_init_defaults(&rev);
> -	rev.abbrev_commit = 1;
> -	rev.commit_format = CMIT_FMT_ONELINE;
> -	rev.use_terminator = 1;
> +	if (cfg_have_pretty != 0) {
I'd write just "if (cfg_have_pretty)".
>  	rev.always_show_header = 1;
> +
>  	cmd_log_init_finish(argc, argv, prefix, &rev, &opt);
Avoid adding unrelated whitespace changes like this one.
Regards,
-- 
Matthieu Moy
https://matthieu-moy.fr/
Previous: Roland HieberNext: Roland Hieber
Message 2 of 5 in “reflog: specify default pretty format in config”
  1. reflog: specify default pretty format in configRoland Hieber, Jan 30, 2019
  2. Matthieu MoyJan 30, 2019
  3. Roland HieberJan 31, 2019
  4. reflog: specify default pretty format in configRoland Hieber, Feb 8, 2019
  5. Junio C HamanoFeb 11, 2019

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.