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

Re: [PATCH] advice: recommend GIT_ADVICE=0 for tools

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2024, 20:26 UTC
Message-ID
<xmqq4j6t26fs.fsf@gitster.g>
In-Reply-To
<pull.1781.git.1725559154387.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
>  advice.*::
>  	These variables control various optional help messages designed to
> -	aid new users.  When left unconfigured, Git will give the message
> -	alongside instructions on how to squelch it.  You can tell Git
> -	that you do not need the help message by setting these to `false`:
> +	aid new users. These are output to `stderr` by default as they are
> +	intended to help human readers. Tools that execute Git as a subprocess
> +	can disable these messages by setting `GIT_ACVICE=0` in the environment.
> ++
> +When left unconfigured, Git will give the message alongside instructions on how
> +to squelch it.  You can tell Git that you do not need the help message by
> +setting these to `false`:

This somehow makes it sounds like it is an "aside, by the way" that these trigger by default and that you can selectively disable it by setting these variables, but shouldn't the stress be the other way around? Shouldn't the mention of GIT_ADVICE be a side note, leaving primary text target human users?

Perhaps like this?
Thanks.
 Documentation/config/advice.txt |  8 +++++++-
 Documentation/git.txt           | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git c/Documentation/config/advice.txt w/Documentation/config/advice.txt
index 0ba8989820..d749aee7f4 100644
--- c/Documentation/config/advice.txt
+++ w/Documentation/config/advice.txt
@@ -2,7 +2,13 @@ advice.*::
 	These variables control various optional help messages designed to
 	aid new users.  When left unconfigured, Git will give the message
 	alongside instructions on how to squelch it.  You can tell Git
-	that you do not need the help message by setting these to `false`:
+	that you have understood the issue and no longer need a specific
+	help message by setting the corresponding variable to `false`.
++
+As they are intended to help human users, these messages are output
+to the standard error.  When tools that run Git as a subprocesses
+find them disruptive, they can set `GIT_ADVICE=0` in the environment
+to squelch all advice messages.
 +
 --
 	addEmbeddedRepo::
diff --git c/Documentation/git.txt w/Documentation/git.txt
index 4489e2297a..d15a869762 100644
--- c/Documentation/git.txt
+++ w/Documentation/git.txt
@@ -1027,6 +1027,17 @@ standard output.
 	adequate and support for it is likely to be removed in the
 	foreseeable future (along with the variable).
 
+`GIT_ADVICE`::
+	If set to `0`, then disable all advice messages. These messages are
+	intended to provide hints to human users that may help them get out of
+	problematic situations or take advantage of new features. Users can
+	disable individual messages using the `advice.*` config keys. These
+	messages may be disruptive to tools that execute Git processes, so this
+	variable is available to disable the messages. (The `--no-advice`
+	global option is also available, but old Git versions may fail when
+	this option is not understood. The environment variable will be ignored
+	by Git versions that do not understand it.)
+
 Discussion[[Discussion]]
 ------------------------
 
Previous: Derrick StoleeNext: Derrick Stolee
Message 4 of 6 in “advice: recommend GIT_ADVICE=0 for tools”
  1. advice: recommend GIT_ADVICE=0 for toolsDerrick Stolee via GitGitGadget, Sep 5, 2024
  2. Eric SunshineSep 5, 2024
  3. Derrick StoleeSep 6, 2024
  4. Junio C HamanoSep 5, 2024
  5. Derrick StoleeSep 6, 2024
  6. advice: recommend GIT_ADVICE=0 for toolsDerrick Stolee via GitGitGadget, Sep 6, 2024

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.