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

Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2021, 06:57 UTC
Message-ID
<xmqqmtsbv19u.fsf@gitster.g>
In-Reply-To
<YLSGasYc4wVoOfYt@danh.dev>
Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:
> Please use your real name and wrap your commit message at 50
> characters for subject line and 72 characters for body.
Very good suggestions.  Thanks for raising these issues.
Show 12 quoted lines
> The default option is documented correctly as short.
> Please check out builtin/log.c:decorate_callback and
> builtin/log.c:parse_decoration_style.
>
> Below command print nothing in my machine:
>
> 	git log --decorate -1 >/tmp/default
> 	git log --decorate=short -1 >/tmp/short
> 	cmp /tmp/default /tmp/short
>
> I'm curious about your config and/or command invocation.
> From the code, I can't guess which scenario that's different.

You two are thinking about two "defaults", I think. If a --decorate option you give does not say which kind of decoration you want, by default, you see the short output. The above shows that.

If you do not give any --decorate option, the command behaves as if you gave --decorate=auto, which is what the patch author wanted to say, I think.

> I think you meant:
>
> 	git log -1 >/tmp/no-decorate

Yes, and this (with redirection to file), I think you do not get any decoration---that is what you get from --decorate=auto, i.e.

	git log --decorate=auto -1 >/tmp/auto-decorate

I think the default discussed in the paragraph the patch touches is "what happens if you do not say what kind, i.e. "--decorate" not "--decorate=<what kind>", so "the default is 'short'" is correct, but at the same time, "even if you do not say --decorate, you'll see short decoration when on a terminal" is worth mentioning somewhere.

Previous: Đoàn Trần Công DanhNext: Đoàn Trần Công Danh
Message 4 of 8 in “describe-doc:fix a obscure error description in the git log documentation”
  1. describe-doc:fix a obscure error description in the git log documentationAndy AO via GitGitGadget, May 31, 2021
  2. Bagas SanjayaMay 31, 2021
  3. Đoàn Trần Công DanhMay 31, 2021
  4. Junio C HamanoMay 31, 2021
  5. Đoàn Trần Công DanhMay 31, 2021
  6. Bagas SanjayaMay 31, 2021
  7. Đoàn Trần Công DanhMay 31, 2021
  8. doc/log: correct default for --decorateĐoàn Trần Công Danh, Jun 8, 2021

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.