Subject: Re: [PATCH 1/3] add: use advise_if_enabled for ADVICE_ADD_IGNORED_FILE

From: Junio C Hamano <[email-masked]>
Date: Fri, 29 Mar 2024 10:40:05 -0700

Rubén Justo <[email-masked]> writes:

> -		if (advice_enabled(ADVICE_ADD_IGNORED_FILE))
> -			advise(_("Use -f if you really want to add them.\n"
> -				"Turn this message off by running\n"
> -				"\"git config advice.addIgnoredFile false\""));
> +		advise_if_enabled(ADVICE_ADD_IGNORED_FILE,
> +				  _("Use -f if you really want to add them."));

Good.

>  		exit_status = 1;
>  	}
>  
> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
> index f23d39f0d5..76c2c9e7b0 100755
> --- a/t/t3700-add.sh
> +++ b/t/t3700-add.sh
> @@ -370,8 +370,7 @@ cat >expect.err <<\EOF
>  The following paths are ignored by one of your .gitignore files:
>  ignored-file
>  hint: Use -f if you really want to add them.
> -hint: Turn this message off by running
> -hint: "git config advice.addIgnoredFile false"
> +hint: Disable this message with "git config advice.addIgnoredFile false"

Funny that we weremanually crafting the hint to turn it off.  Nice
to see that code go.

>  EOF
>  cat >expect.out <<\EOF
>  add 'track-this'
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 00c1f1aab1..5c4a89df5c 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -212,8 +212,7 @@ test_expect_success 'submodule add to .gitignored path fails' '
>  		The following paths are ignored by one of your .gitignore files:
>  		submod
>  		hint: Use -f if you really want to add them.
> -		hint: Turn this message off by running
> -		hint: "git config advice.addIgnoredFile false"
> +		hint: Disable this message with "git config advice.addIgnoredFile false"
>  		EOF
>  		# Does not use test_commit due to the ignore
>  		echo "*" > .gitignore &&