Git fork

advice: suggest using subcommand "git config set"

The advice message currently suggests using "git config advice..." to
disable advice messages, but since

00bbdde141 (builtin/config: introduce "set" subcommand, 2024-05-06)

we have the "set" subcommand for config. Since using the subcommand is
more in-line with the modern interface, any advice should be promoting
its usage. Change the disable advice message to use the subcommand
instead. Change all uses of "git config advice" in the tests to use the
subcommand.

Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Bence Ferdinandy and committed by
Junio C Hamano
6c397d01 4f71522d

+27 -27
+1 -1
advice.c
··· 93 93 94 94 static const char turn_off_instructions[] = 95 95 N_("\n" 96 - "Disable this message with \"git config advice.%s false\""); 96 + "Disable this message with \"git config set advice.%s false\""); 97 97 98 98 static void vadvise(const char *advice, int display_instructions, 99 99 const char *key, va_list params)
+1 -1
commit.c
··· 270 270 "to convert the grafts into replace refs.\n" 271 271 "\n" 272 272 "Turn this message off by running\n" 273 - "\"git config advice.graftFileDeprecated false\"")); 273 + "\"git config set advice.graftFileDeprecated false\"")); 274 274 while (!strbuf_getwholeline(&buf, fp, '\n')) { 275 275 /* The format is just "Commit Parent1 Parent2 ...\n" */ 276 276 struct commit_graft *graft = read_graft_line(&buf);
+1 -1
hook.c
··· 39 39 advise(_("The '%s' hook was ignored because " 40 40 "it's not set as executable.\n" 41 41 "You can disable this warning with " 42 - "`git config advice.ignoredHook false`."), 42 + "`git config set advice.ignoredHook false`."), 43 43 path.buf); 44 44 } 45 45 }
+1 -1
object-name.c
··· 943 943 "\n" 944 944 "where \"$br\" is somehow empty and a 40-hex ref is created. Please\n" 945 945 "examine these refs and maybe delete them. Turn this message off by\n" 946 - "running \"git config advice.objectNameWarning false\""); 946 + "running \"git config set advice.objectNameWarning false\""); 947 947 struct object_id tmp_oid; 948 948 char *real_ref = NULL; 949 949 int refs_found = 0;
+1 -1
t/t0018-advice.sh
··· 11 11 test_expect_success 'advice should be printed when config variable is unset' ' 12 12 cat >expect <<-\EOF && 13 13 hint: This is a piece of advice 14 - hint: Disable this message with "git config advice.nestedTag false" 14 + hint: Disable this message with "git config set advice.nestedTag false" 15 15 EOF 16 16 test-tool advise "This is a piece of advice" 2>actual && 17 17 test_cmp expect actual
+1 -1
t/t3200-branch.sh
··· 1697 1697 cat <<-\EOF >expect && 1698 1698 fatal: '\''foo..bar'\'' is not a valid branch name 1699 1699 hint: See `man git check-ref-format` 1700 - hint: Disable this message with "git config advice.refSyntax false" 1700 + hint: Disable this message with "git config set advice.refSyntax false" 1701 1701 EOF 1702 1702 test_must_fail git branch foo..bar >actual 2>&1 && 1703 1703 test_cmp expect actual
+3 -3
t/t3404-rebase-interactive.sh
··· 2235 2235 error: ${SQ}pick${SQ} does not accept merge commits 2236 2236 hint: ${SQ}pick${SQ} does not take a merge commit. If you wanted to 2237 2237 hint: replay the merge, use ${SQ}merge -C${SQ} on the commit. 2238 - hint: Disable this message with "git config advice.rebaseTodoError false" 2238 + hint: Disable this message with "git config set advice.rebaseTodoError false" 2239 2239 error: invalid line 1: pick $oid 2240 2240 error: ${SQ}reword${SQ} does not accept merge commits 2241 2241 hint: ${SQ}reword${SQ} does not take a merge commit. If you wanted to 2242 2242 hint: replay the merge and reword the commit message, use 2243 2243 hint: ${SQ}merge -c${SQ} on the commit 2244 - hint: Disable this message with "git config advice.rebaseTodoError false" 2244 + hint: Disable this message with "git config set advice.rebaseTodoError false" 2245 2245 error: invalid line 2: reword $oid 2246 2246 error: ${SQ}edit${SQ} does not accept merge commits 2247 2247 hint: ${SQ}edit${SQ} does not take a merge commit. If you wanted to 2248 2248 hint: replay the merge, use ${SQ}merge -C${SQ} on the commit, and then 2249 2249 hint: ${SQ}break${SQ} to give the control back to you so that you can 2250 2250 hint: do ${SQ}git commit --amend && git rebase --continue${SQ}. 2251 - hint: Disable this message with "git config advice.rebaseTodoError false" 2251 + hint: Disable this message with "git config set advice.rebaseTodoError false" 2252 2252 error: invalid line 3: edit $oid 2253 2253 error: cannot squash merge commit into another commit 2254 2254 error: invalid line 4: fixup $oid
+1 -1
t/t3501-revert-cherry-pick.sh
··· 178 178 hint: You can instead skip this commit with "git revert --skip". 179 179 hint: To abort and get back to the state before "git revert", 180 180 hint: run "git revert --abort". 181 - hint: Disable this message with "git config advice.mergeConflict false" 181 + hint: Disable this message with "git config set advice.mergeConflict false" 182 182 EOF 183 183 test_commit --append --no-tag "double-add dream" dream dream && 184 184 test_must_fail git revert HEAD^ 2>actual &&
+3 -3
t/t3507-cherry-pick-conflict.sh
··· 34 34 git commit --allow-empty --allow-empty-message && 35 35 git tag empty && 36 36 git checkout main && 37 - git config advice.detachedhead false 37 + git config set advice.detachedhead false 38 38 39 39 ' 40 40 ··· 60 60 hint: You can instead skip this commit with "git cherry-pick --skip". 61 61 hint: To abort and get back to the state before "git cherry-pick", 62 62 hint: run "git cherry-pick --abort". 63 - hint: Disable this message with "git config advice.mergeConflict false" 63 + hint: Disable this message with "git config set advice.mergeConflict false" 64 64 EOF 65 65 test_must_fail git cherry-pick picked 2>actual && 66 66 ··· 75 75 error: could not apply \$picked... picked 76 76 hint: after resolving the conflicts, mark the corrected paths 77 77 hint: with 'git add <paths>' or 'git rm <paths>' 78 - hint: Disable this message with \"git config advice.mergeConflict false\" 78 + hint: Disable this message with \"git config set advice.mergeConflict false\" 79 79 EOF 80 80 test_must_fail git cherry-pick --no-commit picked 2>actual && 81 81
+1 -1
t/t3510-cherry-pick-sequence.sh
··· 25 25 } 26 26 27 27 test_expect_success setup ' 28 - git config advice.detachedhead false && 28 + git config set advice.detachedhead false && 29 29 echo unrelated >unrelated && 30 30 git add unrelated && 31 31 test_commit initial foo a &&
+1 -1
t/t3511-cherry-pick-x.sh
··· 52 52 " 53 53 54 54 test_expect_success setup ' 55 - git config advice.detachedhead false && 55 + git config set advice.detachedhead false && 56 56 echo unrelated >unrelated && 57 57 git add unrelated && 58 58 test_commit initial foo a &&
+1 -1
t/t3602-rm-sparse-checkout.sh
··· 21 21 hint: If you intend to update such entries, try one of the following: 22 22 hint: * Use the --sparse option. 23 23 hint: * Disable or modify the sparsity rules. 24 - hint: Disable this message with \"git config advice.updateSparsePath false\" 24 + hint: Disable this message with \"git config set advice.updateSparsePath false\" 25 25 EOF 26 26 27 27 echo b | cat sparse_error_header - >sparse_entry_b_error &&
+3 -3
t/t3700-add.sh
··· 32 32 cat >expect <<-EOF && 33 33 Nothing specified, nothing added. 34 34 hint: Maybe you wanted to say ${SQ}git add .${SQ}? 35 - hint: Disable this message with "git config advice.addEmptyPathspec false" 35 + hint: Disable this message with "git config set advice.addEmptyPathspec false" 36 36 EOF 37 37 git add 2>actual && 38 38 test_cmp expect actual ··· 376 376 hint: git rm --cached inner1 377 377 hint: 378 378 hint: See "git help submodule" for more information. 379 - hint: Disable this message with "git config advice.addEmbeddedRepo false" 379 + hint: Disable this message with "git config set advice.addEmbeddedRepo false" 380 380 warning: adding embedded git repository: inner2 381 381 EOF 382 382 test_cmp expect actual ··· 414 414 The following paths are ignored by one of your .gitignore files: 415 415 ignored-file 416 416 hint: Use -f if you really want to add them. 417 - hint: Disable this message with "git config advice.addIgnoredFile false" 417 + hint: Disable this message with "git config set advice.addIgnoredFile false" 418 418 EOF 419 419 cat >expect.out <<\EOF 420 420 add 'track-this'
+1 -1
t/t3705-add-sparse-checkout.sh
··· 54 54 hint: If you intend to update such entries, try one of the following: 55 55 hint: * Use the --sparse option. 56 56 hint: * Disable or modify the sparsity rules. 57 - hint: Disable this message with \"git config advice.updateSparsePath false\" 57 + hint: Disable this message with \"git config set advice.updateSparsePath false\" 58 58 EOF 59 59 60 60 echo sparse_entry | cat sparse_error_header - >sparse_entry_error &&
+2 -2
t/t7002-mv-sparse-checkout.sh
··· 33 33 hint: If you intend to update such entries, try one of the following: 34 34 hint: * Use the --sparse option. 35 35 hint: * Disable or modify the sparsity rules. 36 - hint: Disable this message with \"git config advice.updateSparsePath false\" 36 + hint: Disable this message with \"git config set advice.updateSparsePath false\" 37 37 EOF 38 38 39 39 cat >dirty_error_header <<-EOF && ··· 46 46 hint: To correct the sparsity of these paths, do the following: 47 47 hint: * Use \"git add --sparse <paths>\" to update the index 48 48 hint: * Use \"git sparse-checkout reapply\" to apply the sparsity rules 49 - hint: Disable this message with \"git config advice.updateSparsePath false\" 49 + hint: Disable this message with \"git config set advice.updateSparsePath false\" 50 50 EOF 51 51 " 52 52
+1 -1
t/t7004-tag.sh
··· 1896 1896 hint: already a tag. If you meant to tag the object that it points to, use: 1897 1897 hint: 1898 1898 hint: git tag -f nested annotated-v4.0^{} 1899 - hint: Disable this message with "git config advice.nestedTag false" 1899 + hint: Disable this message with "git config set advice.nestedTag false" 1900 1900 EOF 1901 1901 git tag -m nested nested annotated-v4.0 2>actual && 1902 1902 test_cmp expect actual
+2 -2
t/t7201-co.sh
··· 225 225 ' 226 226 227 227 test_expect_success 'checkout to detach HEAD (with advice declined)' ' 228 - git config advice.detachedHead false && 228 + git config set advice.detachedHead false && 229 229 rev=$(git rev-parse --short renamer^) && 230 230 git checkout -f renamer && 231 231 git clean -f && ··· 245 245 ' 246 246 247 247 test_expect_success 'checkout to detach HEAD' ' 248 - git config advice.detachedHead true && 248 + git config set advice.detachedHead true && 249 249 rev=$(git rev-parse --short renamer^) && 250 250 git checkout -f renamer && 251 251 git clean -f &&
+1 -1
t/t7400-submodule-basic.sh
··· 212 212 The following paths are ignored by one of your .gitignore files: 213 213 submod 214 214 hint: Use -f if you really want to add them. 215 - hint: Disable this message with "git config advice.addIgnoredFile false" 215 + hint: Disable this message with "git config set advice.addIgnoredFile false" 216 216 EOF 217 217 # Does not use test_commit due to the ignore 218 218 echo "*" > .gitignore &&
+1 -1
t/t7508-status.sh
··· 1700 1700 EOF 1701 1701 git add .gitignore && 1702 1702 git commit -m "Add .gitignore" && 1703 - git config advice.statusuoption true 1703 + git config set advice.statusuoption true 1704 1704 ) 1705 1705 ' 1706 1706