advice: recommend GIT_ADVICE=0 for tools
The GIT_ADVICE environment variable was added implicitly in b79deeb5544 (advice: add --no-advice global option, 2024-05-03) but was not documented. Add documentation to show that it is an option for tools that want to disable these messages. Make note that while the --no-advice option exists, older Git versions will fail to parse that option. The environment variable presents a way to change the behavior of Git versions that understand it without disrupting older versions. Co-authored-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Sep 6, 2024 at 20:22 UTC
fb2b9815a4b5ea04a5f08940f546c6d5ef5e2414
2 files changed
+18
-1
Documentation/config/advice.txt
+7
-1
@@ -2,7 +2,13 @@ advice.*::
2
These variables control various optional help messages designed to
3
aid new users. When left unconfigured, Git will give the message
4
alongside instructions on how to squelch it. You can tell Git
5
- that you do not need the help message by setting these to `false`:
5
+ that you have understood the issue and no longer need a specific
6
+ help message by setting the corresponding variable to `false`.
7
++
8
+As they are intended to help human users, these messages are output to
9
+the standard error. When tools that run Git as a subprocess find them
10
+disruptive, they can set `GIT_ADVICE=0` in the environment to squelch
11
+all advice messages.
12
+
13
--
14
addEmbeddedRepo::
Documentation/git.txt
+11
@@ -1027,6 +1027,17 @@ standard output.
1027
adequate and support for it is likely to be removed in the
1028
foreseeable future (along with the variable).
1029
1030
+`GIT_ADVICE`::
1031
+ If set to `0`, then disable all advice messages. These messages are
1032
+ intended to provide hints to human users that may help them get out of
1033
+ problematic situations or take advantage of new features. Users can
1034
+ disable individual messages using the `advice.*` config keys. These
1035
+ messages may be disruptive to tools that execute Git processes, so this
1036
+ variable is available to disable the messages. (The `--no-advice`
1037
+ global option is also available, but old Git versions may fail when
1038
+ this option is not understood. The environment variable will be ignored
1039
+ by Git versions that do not understand it.)
1040
+
1041
Discussion[[Discussion]]
1042
------------------------
1043