Skip to content

Commit 6c397d0

Browse files
ferdinandybgitster
authored andcommitted
advice: suggest using subcommand "git config set"
The advice message currently suggests using "git config advice..." to disable advice messages, but since 00bbdde (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4f71522 commit 6c397d0

19 files changed

+27
-27
lines changed

advice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static struct {
9393

9494
static const char turn_off_instructions[] =
9595
N_("\n"
96-
"Disable this message with \"git config advice.%s false\"");
96+
"Disable this message with \"git config set advice.%s false\"");
9797

9898
static void vadvise(const char *advice, int display_instructions,
9999
const char *key, va_list params)

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int read_graft_file(struct repository *r, const char *graft_file)
270270
"to convert the grafts into replace refs.\n"
271271
"\n"
272272
"Turn this message off by running\n"
273-
"\"git config advice.graftFileDeprecated false\""));
273+
"\"git config set advice.graftFileDeprecated false\""));
274274
while (!strbuf_getwholeline(&buf, fp, '\n')) {
275275
/* The format is just "Commit Parent1 Parent2 ...\n" */
276276
struct commit_graft *graft = read_graft_line(&buf);

hook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const char *find_hook(const char *name)
3939
advise(_("The '%s' hook was ignored because "
4040
"it's not set as executable.\n"
4141
"You can disable this warning with "
42-
"`git config advice.ignoredHook false`."),
42+
"`git config set advice.ignoredHook false`."),
4343
path.buf);
4444
}
4545
}

object-name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
943943
"\n"
944944
"where \"$br\" is somehow empty and a 40-hex ref is created. Please\n"
945945
"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\"");
947947
struct object_id tmp_oid;
948948
char *real_ref = NULL;
949949
int refs_found = 0;

t/t0018-advice.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TEST_PASSES_SANITIZE_LEAK=true
1111
test_expect_success 'advice should be printed when config variable is unset' '
1212
cat >expect <<-\EOF &&
1313
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"
1515
EOF
1616
test-tool advise "This is a piece of advice" 2>actual &&
1717
test_cmp expect actual

t/t3200-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ test_expect_success 'errors if given a bad branch name' '
16971697
cat <<-\EOF >expect &&
16981698
fatal: '\''foo..bar'\'' is not a valid branch name
16991699
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"
17011701
EOF
17021702
test_must_fail git branch foo..bar >actual 2>&1 &&
17031703
test_cmp expect actual

t/t3404-rebase-interactive.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,20 +2235,20 @@ test_expect_success 'non-merge commands reject merge commits' '
22352235
error: ${SQ}pick${SQ} does not accept merge commits
22362236
hint: ${SQ}pick${SQ} does not take a merge commit. If you wanted to
22372237
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"
22392239
error: invalid line 1: pick $oid
22402240
error: ${SQ}reword${SQ} does not accept merge commits
22412241
hint: ${SQ}reword${SQ} does not take a merge commit. If you wanted to
22422242
hint: replay the merge and reword the commit message, use
22432243
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"
22452245
error: invalid line 2: reword $oid
22462246
error: ${SQ}edit${SQ} does not accept merge commits
22472247
hint: ${SQ}edit${SQ} does not take a merge commit. If you wanted to
22482248
hint: replay the merge, use ${SQ}merge -C${SQ} on the commit, and then
22492249
hint: ${SQ}break${SQ} to give the control back to you so that you can
22502250
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"
22522252
error: invalid line 3: edit $oid
22532253
error: cannot squash merge commit into another commit
22542254
error: invalid line 4: fixup $oid

t/t3501-revert-cherry-pick.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ test_expect_success 'advice from failed revert' '
178178
hint: You can instead skip this commit with "git revert --skip".
179179
hint: To abort and get back to the state before "git revert",
180180
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"
182182
EOF
183183
test_commit --append --no-tag "double-add dream" dream dream &&
184184
test_must_fail git revert HEAD^ 2>actual &&

t/t3507-cherry-pick-conflict.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_expect_success setup '
3434
git commit --allow-empty --allow-empty-message &&
3535
git tag empty &&
3636
git checkout main &&
37-
git config advice.detachedhead false
37+
git config set advice.detachedhead false
3838
3939
'
4040

@@ -60,7 +60,7 @@ test_expect_success 'advice from failed cherry-pick' '
6060
hint: You can instead skip this commit with "git cherry-pick --skip".
6161
hint: To abort and get back to the state before "git cherry-pick",
6262
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"
6464
EOF
6565
test_must_fail git cherry-pick picked 2>actual &&
6666
@@ -75,7 +75,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
7575
error: could not apply \$picked... picked
7676
hint: after resolving the conflicts, mark the corrected paths
7777
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\"
7979
EOF
8080
test_must_fail git cherry-pick --no-commit picked 2>actual &&
8181

t/t3510-cherry-pick-sequence.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pristine_detach () {
2525
}
2626

2727
test_expect_success setup '
28-
git config advice.detachedhead false &&
28+
git config set advice.detachedhead false &&
2929
echo unrelated >unrelated &&
3030
git add unrelated &&
3131
test_commit initial foo a &&

0 commit comments

Comments
 (0)