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

Re: [PATCH v4 2/3] pretty: enable --expand-tabs by default for selected pretty formats

From
Jeff King <peff@peff.net>
Date
Mar 30, 2016, 01:38 UTC
Message-ID
<20160330013851.GF2237@sigill.intra.peff.net>
In-Reply-To
<1459293309-25195-3-git-send-email-gitster@pobox.com>
On Tue, Mar 29, 2016 at 04:15:08PM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
> index 4fb5c76..23967b6 100644
> --- a/Documentation/pretty-options.txt
> +++ b/Documentation/pretty-options.txt
> @@ -43,10 +43,16 @@ people using 80-column terminals.
>  	commit may be copied to the output.
>  
>  --expand-tabs::
> +--no-expand-tabs::
>  	Perform a tab expansion (replace each tab with enough number
>  	of spaces to fill to the next display column that is
>  	multiple of 8) in the log message before using the message
>  	to show in the output.
> ++
> +By default, tabs are expanded in pretty formats that indent the log
> +message by 4 spaces (i.e.  'medium', which is the default, 'full',
> +and "fuller').  `--no-expand-tabs` option can be used to disable
> +this.
Mismatched quote types on "fuller".
Show 8 quoted lines
> @@ -172,6 +173,7 @@ void get_commit_format(const char *arg, struct rev_info *rev)
>  
>  	rev->commit_format = commit_format->format;
>  	rev->use_terminator = commit_format->is_tformat;
> +	rev->expand_tabs_in_log = commit_format->expand_tabs_in_log;
>  	if (commit_format->format == CMIT_FMT_USERFORMAT) {
>  		save_user_format(rev, commit_format->user_format,
>  				 commit_format->is_tformat);

This feels like the wrong time to set the value in rev_info, as it means that:

  git log --no-expand-tabs --pretty=full
and
  git log --pretty=full --no-expand-tabs

behave differently. The other values set in get_commit_format, like "use_terminator", are inherently part of the format, but I don't think this is. We just want to set the default if the user did not express another preference.

Likewise, if we were to eventually add config like "[log]expandtab = 4", it should not be overridden by "--pretty=full" (but we probably _would_ want to have it kick in only for certain formats).

So I think we really want to set an alternate variable here, and then do something like:

  if (rev->expand_tabs_in_log < 0)
	rev->expand_tabs_in_log = rev->commit_format_expand_tab_default;
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 41 of 57 in “pretty-print: de-tabify indented logs to make things line up properly”
  1. pretty-print: de-tabify indented logs to make things line up properlyLinus Torvalds, Mar 16, 2016
  2. Linus TorvaldsMar 16, 2016
  3. Junio C HamanoMar 16, 2016
  4. Linus TorvaldsMar 16, 2016
  5. Junio C HamanoMar 16, 2016
  6. Junio C HamanoMar 16, 2016
  7. Linus TorvaldsMar 16, 2016
  8. Junio C HamanoMar 16, 2016
  9. Linus TorvaldsMar 16, 2016
  10. 1/4 pretty-print: de-tabify indented logs to make things line up properlyJunio C Hamano, Mar 17, 2016
  11. 2/4 pretty-print: simplify the interaction between pp_handle_indent() and its callerJunio C Hamano, Mar 17, 2016
  12. 3/4 pretty-print: further abstract out pp_handle_indent()Junio C Hamano, Mar 17, 2016
  13. 4/4 pretty-print: add --pretty=noexpandJunio C Hamano, Mar 17, 2016
  14. Linus TorvaldsMar 17, 2016
  15. Junio C HamanoMar 17, 2016
  16. Jeff KingMar 18, 2016
  17. Linus TorvaldsMar 18, 2016
  18. Jeff KingMar 18, 2016
  19. Junio C HamanoMar 18, 2016
  20. 0/5 Expanding tabs in "git log" outputJunio C Hamano, Mar 23, 2016
  21. 1/5 pretty-print: de-tabify indented logs to make things line up properlyJunio C Hamano, Mar 23, 2016
  22. 2/5 pretty-print: simplify the interaction between pp_handle_indent() and its callerJunio C Hamano, Mar 23, 2016
  23. 3/5 pretty-print: further abstract out pp_handle_indent()Junio C Hamano, Mar 23, 2016
  24. 4/5 pretty-print: limit expand-tabs to selected --pretty formatsJunio C Hamano, Mar 23, 2016
  25. 5/5 pretty-print: teach "--no-expand-tabs" option to "git log"Junio C Hamano, Mar 23, 2016
  26. Linus TorvaldsMar 23, 2016
  27. Jeff KingMar 24, 2016
  28. Junio C HamanoMar 24, 2016
  29. Torsten BögershausenMar 24, 2016
  30. Junio C HamanoMar 24, 2016
  31. Junio C HamanoMar 24, 2016
  32. Torsten BögershausenMar 25, 2016
  33. Torsten BögershausenMar 25, 2016
  34. Junio C HamanoMar 25, 2016
  35. Junio C HamanoMar 25, 2016
  36. 0/3 Expanding tabs in "git log" outputJunio C Hamano, Mar 29, 2016
  37. 1/3 pretty: expand tabs in indented logs to make things line up properlyJunio C Hamano, Mar 29, 2016
  38. Eric SunshineMar 30, 2016
  39. Junio C HamanoMar 30, 2016
  40. 2/3 pretty: enable --expand-tabs by default for selected pretty formatsJunio C Hamano, Mar 29, 2016
  41. Jeff KingMar 30, 2016
  42. Junio C HamanoMar 30, 2016
  43. 3/3 pretty: allow tweaking tabwidth in --expand-tabsJunio C Hamano, Mar 29, 2016
  44. 0/4 Expanding tabs in "git log" outputJunio C Hamano, Apr 5, 2016
  45. 1/4 pretty: expand tabs in indented logs to make things line up properlyJunio C Hamano, Apr 5, 2016
  46. 2/4 pretty: enable --expand-tabs by default for selected pretty formatsJunio C Hamano, Apr 5, 2016
  47. 3/4 pretty: allow tweaking tabwidth in --expand-tabsJunio C Hamano, Apr 5, 2016
  48. 4/4 pretty: test --expand-tabsJunio C Hamano, Apr 5, 2016
  49. Eric SunshineApr 5, 2016
  50. Jeff KingApr 5, 2016
  51. Junio C HamanoApr 5, 2016
  52. Jeff KingApr 5, 2016
  53. Junio C HamanoApr 5, 2016
  54. Perry HutchisonApr 5, 2016
  55. Jeff KingApr 5, 2016
  56. Linus TorvaldsMar 16, 2016
  57. Junio C HamanoMar 16, 2016

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.