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>
Bence Ferdinandy committed
Dec 5, 2024 at 13:21 UTC
6c397d01046251b4d26f2aded07a695ada196962
19 files changed
+27
-27
advice.c
+1
-1
@@ -93,7 +93,7 @@ static struct {
93
94
static const char turn_off_instructions[] =
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
98
static void vadvise(const char *advice, int display_instructions,
99
const char *key, va_list params)
commit.c
+1
-1
@@ -270,7 +270,7 @@ static int read_graft_file(struct repository *r, const char *graft_file)
270
"to convert the grafts into replace refs.\n"
271
"\n"
272
"Turn this message off by running\n"
273
- "\"git config advice.graftFileDeprecated false\""));
273
+ "\"git config set advice.graftFileDeprecated false\""));
274
while (!strbuf_getwholeline(&buf, fp, '\n')) {
275
/* The format is just "Commit Parent1 Parent2 ...\n" */
276
struct commit_graft *graft = read_graft_line(&buf);
hook.c
+1
-1
@@ -39,7 +39,7 @@ const char *find_hook(const char *name)
39
advise(_("The '%s' hook was ignored because "
40
"it's not set as executable.\n"
41
"You can disable this warning with "
42
- "`git config advice.ignoredHook false`."),
42
+ "`git config set advice.ignoredHook false`."),
43
path.buf);
44
}
45
}
object-name.c
+1
-1
@@ -943,7 +943,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
943
"\n"
944
"where \"$br\" is somehow empty and a 40-hex ref is created. Please\n"
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
struct object_id tmp_oid;
948
char *real_ref = NULL;
949
int refs_found = 0;
t/t0018-advice.sh
+1
-1
@@ -11,7 +11,7 @@ TEST_PASSES_SANITIZE_LEAK=true
11
test_expect_success 'advice should be printed when config variable is unset' '
12
cat >expect <<-\EOF &&
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
EOF
16
test-tool advise "This is a piece of advice" 2>actual &&
17
test_cmp expect actual
t/t3200-branch.sh
+1
-1
@@ -1697,7 +1697,7 @@ test_expect_success 'errors if given a bad branch name' '
1697
cat <<-\EOF >expect &&
1698
fatal: '\''foo..bar'\'' is not a valid branch name
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
EOF
1702
test_must_fail git branch foo..bar >actual 2>&1 &&
1703
test_cmp expect actual
t/t3404-rebase-interactive.sh
+3
-3
@@ -2235,20 +2235,20 @@ test_expect_success 'non-merge commands reject merge commits' '
2235
error: ${SQ}pick${SQ} does not accept merge commits
2236
hint: ${SQ}pick${SQ} does not take a merge commit. If you wanted to
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
error: invalid line 1: pick $oid
2240
error: ${SQ}reword${SQ} does not accept merge commits
2241
hint: ${SQ}reword${SQ} does not take a merge commit. If you wanted to
2242
hint: replay the merge and reword the commit message, use
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
error: invalid line 2: reword $oid
2246
error: ${SQ}edit${SQ} does not accept merge commits
2247
hint: ${SQ}edit${SQ} does not take a merge commit. If you wanted to
2248
hint: replay the merge, use ${SQ}merge -C${SQ} on the commit, and then
2249
hint: ${SQ}break${SQ} to give the control back to you so that you can
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
error: invalid line 3: edit $oid
2253
error: cannot squash merge commit into another commit
2254
error: invalid line 4: fixup $oid
t/t3501-revert-cherry-pick.sh
+1
-1
@@ -178,7 +178,7 @@ test_expect_success 'advice from failed revert' '
178
hint: You can instead skip this commit with "git revert --skip".
179
hint: To abort and get back to the state before "git revert",
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
EOF
183
test_commit --append --no-tag "double-add dream" dream dream &&
184
test_must_fail git revert HEAD^ 2>actual &&
t/t3507-cherry-pick-conflict.sh
+3
-3
@@ -34,7 +34,7 @@ test_expect_success setup '
34
git commit --allow-empty --allow-empty-message &&
35
git tag empty &&
36
git checkout main &&
37
- git config advice.detachedhead false
37
+ git config set advice.detachedhead false
38
39
'
40
@@ -60,7 +60,7 @@ test_expect_success 'advice from failed cherry-pick' '
60
hint: You can instead skip this commit with "git cherry-pick --skip".
61
hint: To abort and get back to the state before "git cherry-pick",
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
EOF
65
test_must_fail git cherry-pick picked 2>actual &&
66
@@ -75,7 +75,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
75
error: could not apply \$picked... picked
76
hint: after resolving the conflicts, mark the corrected paths
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
EOF
80
test_must_fail git cherry-pick --no-commit picked 2>actual &&
81
t/t3510-cherry-pick-sequence.sh
+1
-1
@@ -25,7 +25,7 @@ pristine_detach () {
25
}
26
27
test_expect_success setup '
28
- git config advice.detachedhead false &&
28
+ git config set advice.detachedhead false &&
29
echo unrelated >unrelated &&
30
git add unrelated &&
31
test_commit initial foo a &&
t/t3511-cherry-pick-x.sh
+1
-1
@@ -52,7 +52,7 @@ trailing empty lines
52
"
53
54
test_expect_success setup '
55
- git config advice.detachedhead false &&
55
+ git config set advice.detachedhead false &&
56
echo unrelated >unrelated &&
57
git add unrelated &&
58
test_commit initial foo a &&
t/t3602-rm-sparse-checkout.sh
+1
-1
@@ -21,7 +21,7 @@ test_expect_success 'setup' "
21
hint: If you intend to update such entries, try one of the following:
22
hint: * Use the --sparse option.
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
EOF
26
27
echo b | cat sparse_error_header - >sparse_entry_b_error &&
t/t3700-add.sh
+3
-3
@@ -32,7 +32,7 @@ test_expect_success 'Test with no pathspecs' '
32
cat >expect <<-EOF &&
33
Nothing specified, nothing added.
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
EOF
37
git add 2>actual &&
38
test_cmp expect actual
@@ -376,7 +376,7 @@ test_expect_success '"git add" a embedded repository' '
376
hint: git rm --cached inner1
377
hint:
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
warning: adding embedded git repository: inner2
381
EOF
382
test_cmp expect actual
@@ -414,7 +414,7 @@ cat >expect.err <<\EOF
414
The following paths are ignored by one of your .gitignore files:
415
ignored-file
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
EOF
419
cat >expect.out <<\EOF
420
add 'track-this'
t/t3705-add-sparse-checkout.sh
+1
-1
@@ -54,7 +54,7 @@ test_expect_success 'setup' "
54
hint: If you intend to update such entries, try one of the following:
55
hint: * Use the --sparse option.
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
EOF
59
60
echo sparse_entry | cat sparse_error_header - >sparse_entry_error &&
t/t7002-mv-sparse-checkout.sh
+2
-2
@@ -33,7 +33,7 @@ test_expect_success 'setup' "
33
hint: If you intend to update such entries, try one of the following:
34
hint: * Use the --sparse option.
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
EOF
38
39
cat >dirty_error_header <<-EOF &&
@@ -46,7 +46,7 @@ test_expect_success 'setup' "
46
hint: To correct the sparsity of these paths, do the following:
47
hint: * Use \"git add --sparse <paths>\" to update the index
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
EOF
51
"
52
t/t7004-tag.sh
+1
-1
@@ -1896,7 +1896,7 @@ test_expect_success 'recursive tagging should give advice' '
1896
hint: already a tag. If you meant to tag the object that it points to, use:
1897
hint:
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
EOF
1901
git tag -m nested nested annotated-v4.0 2>actual &&
1902
test_cmp expect actual
t/t7201-co.sh
+2
-2
@@ -225,7 +225,7 @@ test_expect_success 'switch to another branch while carrying a deletion' '
225
'
226
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
rev=$(git rev-parse --short renamer^) &&
230
git checkout -f renamer &&
231
git clean -f &&
@@ -245,7 +245,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
245
'
246
247
test_expect_success 'checkout to detach HEAD' '
248
- git config advice.detachedHead true &&
248
+ git config set advice.detachedHead true &&
249
rev=$(git rev-parse --short renamer^) &&
250
git checkout -f renamer &&
251
git clean -f &&
t/t7400-submodule-basic.sh
+1
-1
@@ -212,7 +212,7 @@ test_expect_success 'submodule add to .gitignored path fails' '
212
The following paths are ignored by one of your .gitignore files:
213
submod
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
EOF
217
# Does not use test_commit due to the ignore
218
echo "*" > .gitignore &&
t/t7508-status.sh
+1
-1
@@ -1700,7 +1700,7 @@ test_expect_success 'setup slow status advice' '
1700
EOF
1701
git add .gitignore &&
1702
git commit -m "Add .gitignore" &&
1703
- git config advice.statusuoption true
1703
+ git config set advice.statusuoption true
1704
)
1705
'
1706