advice: add --no-advice global option
commitb79deeb55444f9e01a3f6335d7e0507e23e90190
authorJames Liu <james@jamesliu.io>
Fri, 3 May 2024 07:17:06 +0000 (3 17:17 +1000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 3 May 2024 17:36:59 +0000 (3 10:36 -0700)
tree44ece5c77a73a7c18a5c5c4939f481b172e44901
parent5bd8811a734536186dd69ae767a9d58ce01ad7cb
advice: add --no-advice global option

Advice hints must be disabled individually by setting the relevant
advice.* variables to false in the Git configuration. For server-side
and scripted usages of Git where hints can be a hindrance, it can be
cumbersome to maintain configuration to ensure all advice hints are
disabled in perpetuity. This is a particular concern in tests, where
new or changed hints can result in failed assertions.

Add a --no-advice global option to disable all advice hints from being
displayed. This is independent of the toggles for individual advice
hints. Use an internal environment variable (GIT_ADVICE) to ensure this
configuration is propagated to the usage site, even if it executes in a
subprocess.

Signed-off-by: James Liu <james@jamesliu.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git.txt
advice.c
environment.h
git.c
t/t0018-advice.sh