git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] describe-doc:fix a obscure error description in the git log documentation
@ 2021-05-31  6:00 Andy AO via GitGitGadget
  2021-05-31  6:41 ` Bagas Sanjaya
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andy AO via GitGitGadget @ 2021-05-31  6:00 UTC (permalink / raw)
  To: git
  Cc: Bagas Sanjaya, Felipe Contreras, Robert P. J. Day,
	Derrick Stolee, Andy AO, zen96285

From: zen96285 <zen96285@gmail.com>

The git log documentation says "The default option is 'short'." This is wrong. After testing, the default value of '--decorate' is 'auto', not 'short'.

There is no difference between 'auto' and 'short' in terminal, but there is a significant difference in how they behave in the shell.The information generated by the 'short' can be saved in shell variables, while the 'auto' can't.

Signed-off-by: AndyAo Zen96285@gmail.com
---
    describe-doc:fix a obscure error description in the git log documenta…
    
    The git log documentation says "The default option is 'short'." This is
    wrong. After testing, the default value of '--decorate' is 'auto', not
    'short'.
    
    There is no difference between 'auto' and 'short' in terminal, but there
    is a significant difference in how they behave in the shell.The
    information generated by the 'short' can be saved in shell variables,
    while the 'auto' can't.
    
    Signed-off-by: AndyAo Zen96285@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1030%2FAndy-AO%2Ffix_a_obscure_error_description_in_the_git_log_documentation-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1030/Andy-AO/fix_a_obscure_error_description_in_the_git_log_documentation-v1
Pull-Request: https://github.com/git/git/pull/1030

 Documentation/git-log.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 1bbf865a1b2d..37a4694b060a 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -39,7 +39,7 @@ OPTIONS
 	full ref name (including prefix) will be printed. If 'auto' is
 	specified, then if the output is going to a terminal, the ref names
 	are shown as if 'short' were given, otherwise no ref names are
-	shown. The default option is 'short'.
+	shown. The default option is 'auto'.
 
 --decorate-refs=<pattern>::
 --decorate-refs-exclude=<pattern>::

base-commit: 4e42405f00ecbbee412846f48cb0253efeebe726
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  6:00 [PATCH] describe-doc:fix a obscure error description in the git log documentation Andy AO via GitGitGadget
@ 2021-05-31  6:41 ` Bagas Sanjaya
  2021-05-31  6:47 ` Đoàn Trần Công Danh
  2021-06-08  1:58 ` [PATCH] doc/log: correct default for --decorate Đoàn Trần Công Danh
  2 siblings, 0 replies; 8+ messages in thread
From: Bagas Sanjaya @ 2021-05-31  6:41 UTC (permalink / raw)
  To: Andy AO via GitGitGadget, git
  Cc: Felipe Contreras, Robert P. J. Day, Derrick Stolee, Andy AO

Hi Andy, welcome to Git mailing list!

On 31/05/21 13.00, Andy AO via GitGitGadget wrote:
> From: zen96285 <zen96285@gmail.com>
> 
> The git log documentation says "The default option is 'short'." This is wrong. After testing, the default value of '--decorate' is 'auto', not 'short'.
> 
> There is no difference between 'auto' and 'short' in terminal, but there is a significant difference in how they behave in the shell.The information generated by the 'short' can be saved in shell variables, while the 'auto' can't.
> 

Why are info generated with 'short' option (and not 'auto') can be 
assigned to a variable?

> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> index 1bbf865a1b2d..37a4694b060a 100644
> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -39,7 +39,7 @@ OPTIONS
>   	full ref name (including prefix) will be printed. If 'auto' is
>   	specified, then if the output is going to a terminal, the ref names
>   	are shown as if 'short' were given, otherwise no ref names are
> -	shown. The default option is 'short'.
> +	shown. The default option is 'auto'.
>   

Looks OK to me, thanks.

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  6:00 [PATCH] describe-doc:fix a obscure error description in the git log documentation Andy AO via GitGitGadget
  2021-05-31  6:41 ` Bagas Sanjaya
@ 2021-05-31  6:47 ` Đoàn Trần Công Danh
  2021-05-31  6:57   ` Junio C Hamano
  2021-05-31  7:49   ` Bagas Sanjaya
  2021-06-08  1:58 ` [PATCH] doc/log: correct default for --decorate Đoàn Trần Công Danh
  2 siblings, 2 replies; 8+ messages in thread
From: Đoàn Trần Công Danh @ 2021-05-31  6:47 UTC (permalink / raw)
  To: Andy AO via GitGitGadget
  Cc: git, Bagas Sanjaya, Felipe Contreras, Robert P. J. Day,
	Derrick Stolee, Andy AO

On 2021-05-31 06:00:56+0000, Andy AO via GitGitGadget <gitgitgadget@gmail.com> wrote:
> From: zen96285 <zen96285@gmail.com>
> 
> The git log documentation says "The default option is 'short'." This is wrong. After testing, the default value of '--decorate' is 'auto', not 'short'.
> 
> There is no difference between 'auto' and 'short' in terminal, but there is a significant difference in how they behave in the shell.The information generated by the 'short' can be saved in shell variables, while the 'auto' can't.

Please use your real name and wrap your commit message at 50
characters for subject line and 72 characters for body.

Let's the commit message aside.

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.

I think you meant:

	git log -1 >/tmp/no-decorate

In that case, please check your "log.decorate" config.

-- 
Danh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  6:47 ` Đoàn Trần Công Danh
@ 2021-05-31  6:57   ` Junio C Hamano
  2021-05-31  7:18     ` Đoàn Trần Công Danh
  2021-05-31  7:49   ` Bagas Sanjaya
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2021-05-31  6:57 UTC (permalink / raw)
  To: Đoàn Trần Công Danh
  Cc: Andy AO via GitGitGadget, git, Bagas Sanjaya, Felipe Contreras,
	Robert P. J. Day, Derrick Stolee, Andy AO

Đ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.

> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  6:57   ` Junio C Hamano
@ 2021-05-31  7:18     ` Đoàn Trần Công Danh
  0 siblings, 0 replies; 8+ messages in thread
From: Đoàn Trần Công Danh @ 2021-05-31  7:18 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Andy AO via GitGitGadget, git, Bagas Sanjaya, Felipe Contreras,
	Robert P. J. Day, Derrick Stolee, Andy AO

On 2021-05-31 15:57:17+0900, Junio C Hamano <gitster@pobox.com> wrote:
> > 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.

I forgot that I have log.decorate configured to 'short'. *facepalm*

I think something like this should be nice.

----8<----
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 1bbf865a1b..0498e7bacb 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -39,7 +39,9 @@ OPTIONS
 	full ref name (including prefix) will be printed. If 'auto' is
 	specified, then if the output is going to a terminal, the ref names
 	are shown as if 'short' were given, otherwise no ref names are
-	shown. The default option is 'short'.
+	shown. The option `--decorate` is short-hand for `--decorate=short`.
+	Default to configuration value of `log.decorate` if configured,
+	otherwise, `auto`.
 
 --decorate-refs=<pattern>::
 --decorate-refs-exclude=<pattern>::
---->8---------

Andy, feel free to pick this up and re-wording however you like.

-- 
Danh

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  6:47 ` Đoàn Trần Công Danh
  2021-05-31  6:57   ` Junio C Hamano
@ 2021-05-31  7:49   ` Bagas Sanjaya
  2021-05-31 10:00     ` Đoàn Trần Công Danh
  1 sibling, 1 reply; 8+ messages in thread
From: Bagas Sanjaya @ 2021-05-31  7:49 UTC (permalink / raw)
  To: Đoàn Trần Công Danh, Andy AO via GitGitGadget
  Cc: git, Felipe Contreras, Robert P. J. Day, Derrick Stolee, Andy AO

Hi Đoàn,

On 31/05/21 13.47, Đoàn Trần Công Danh wrote:
> On 2021-05-31 06:00:56+0000, Andy AO via GitGitGadget <gitgitgadget@gmail.com> wrote:
>> From: zen96285 <zen96285@gmail.com>
>>
>> The git log documentation says "The default option is 'short'." This is wrong. After testing, the default value of '--decorate' is 'auto', not 'short'.
>>
>> There is no difference between 'auto' and 'short' in terminal, but there is a significant difference in how they behave in the shell.The information generated by the 'short' can be saved in shell variables, while the 'auto' can't.
> 
> Please use your real name and wrap your commit message at 50
> characters for subject line and 72 characters for body.

I think the case here was Andy forwarded this patch from someone, which 
happened to be also himself. Maybe that From: line above can be removed, 
unless that he forwarded from other people (in which From: line must be 
preserved).

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] describe-doc:fix a obscure error description in the git log documentation
  2021-05-31  7:49   ` Bagas Sanjaya
@ 2021-05-31 10:00     ` Đoàn Trần Công Danh
  0 siblings, 0 replies; 8+ messages in thread
From: Đoàn Trần Công Danh @ 2021-05-31 10:00 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Andy AO via GitGitGadget, git, Felipe Contreras,
	Robert P. J. Day, Derrick Stolee, Andy AO

On 2021-05-31 14:49:32+0700, Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> Hi Đoàn,
> 
> On 31/05/21 13.47, Đoàn Trần Công Danh wrote:
> > On 2021-05-31 06:00:56+0000, Andy AO via GitGitGadget <gitgitgadget@gmail.com> wrote:
> > > From: zen96285 <zen96285@gmail.com>
> > > 
> > > The git log documentation says "The default option is 'short'." This is wrong. After testing, the default value of '--decorate' is 'auto', not 'short'.
> > > 
> > > There is no difference between 'auto' and 'short' in terminal, but there is a significant difference in how they behave in the shell.The information generated by the 'short' can be saved in shell variables, while the 'auto' can't.
> > 
> > Please use your real name and wrap your commit message at 50
> > characters for subject line and 72 characters for body.
> 
> I think the case here was Andy forwarded this patch from someone, which
> happened to be also himself. Maybe that From: line above can be removed,
> unless that he forwarded from other people (in which From: line must be
> preserved).

Andy is using GitGitGadget bridge.
That bridge uses its own email address (gitgitgadget@gmail.com).

Thus, the identity in the RFC 822's header: "From" should be ignored,
and we should use the "From: " line in body instead.

In principle, GitGitGadget will use the Author identity in the commit
that was pushed into GitHub to generate such "From: " line.
So, it's Andy's resposibility to configure correct core.name and
core.email in Andy's machine, and create a commit with correct
authorship. Otherwise, GitGitGadget will create above message.

Hope that help.

-- 
Danh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] doc/log: correct default for --decorate
  2021-05-31  6:00 [PATCH] describe-doc:fix a obscure error description in the git log documentation Andy AO via GitGitGadget
  2021-05-31  6:41 ` Bagas Sanjaya
  2021-05-31  6:47 ` Đoàn Trần Công Danh
@ 2021-06-08  1:58 ` Đoàn Trần Công Danh
  2 siblings, 0 replies; 8+ messages in thread
From: Đoàn Trần Công Danh @ 2021-06-08  1:58 UTC (permalink / raw)
  To: git
  Cc: Đoàn Trần Công Danh, Junio C Hamano,
	Bagas Sanjaya, Andy AO

There're two different default options for log --decorate:
* Should `--decorate` be given without any arguments, it's default to
  `short`
* Should neither `--decorate` nor `--no-decorate` be given, it's default
  to the `log.decorate` or `auto`.

We documented the former, but not the latter.

Let's document them, too.

Reported-by: Andy AO <zen96285@gmail.com>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---

 I'm reluctant to send this out since I would like to see Andy get familiar
 with the list.  However, it's a while since the original patch.

 Documentation/git-log.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 1bbf865a1b..0498e7bacb 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -39,7 +39,9 @@ OPTIONS
 	full ref name (including prefix) will be printed. If 'auto' is
 	specified, then if the output is going to a terminal, the ref names
 	are shown as if 'short' were given, otherwise no ref names are
-	shown. The default option is 'short'.
+	shown. The option `--decorate` is short-hand for `--decorate=short`.
+	Default to configuration value of `log.decorate` if configured,
+	otherwise, `auto`.
 
 --decorate-refs=<pattern>::
 --decorate-refs-exclude=<pattern>::
-- 
2.32.0.5.gc7fdd17fde


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-08  2:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  6:00 [PATCH] describe-doc:fix a obscure error description in the git log documentation Andy AO via GitGitGadget
2021-05-31  6:41 ` Bagas Sanjaya
2021-05-31  6:47 ` Đoàn Trần Công Danh
2021-05-31  6:57   ` Junio C Hamano
2021-05-31  7:18     ` Đoàn Trần Công Danh
2021-05-31  7:49   ` Bagas Sanjaya
2021-05-31 10:00     ` Đoàn Trần Công Danh
2021-06-08  1:58 ` [PATCH] doc/log: correct default for --decorate Đoàn Trần Công Danh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).