]> git.ipfire.org Git - thirdparty/git.git/commitdiff
advice: suggest using subcommand "git config set"
authorBence Ferdinandy <bence@ferdinandy.com>
Thu, 5 Dec 2024 12:21:58 +0000 (13:21 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2024 02:24:21 +0000 (11:24 +0900)
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>
19 files changed:
advice.c
commit.c
hook.c
object-name.c
t/t0018-advice.sh
t/t3200-branch.sh
t/t3404-rebase-interactive.sh
t/t3501-revert-cherry-pick.sh
t/t3507-cherry-pick-conflict.sh
t/t3510-cherry-pick-sequence.sh
t/t3511-cherry-pick-x.sh
t/t3602-rm-sparse-checkout.sh
t/t3700-add.sh
t/t3705-add-sparse-checkout.sh
t/t7002-mv-sparse-checkout.sh
t/t7004-tag.sh
t/t7201-co.sh
t/t7400-submodule-basic.sh
t/t7508-status.sh

index 6b879d805c03049a2db67aaebfe3a1cd3aa2297c..f7a5130c2c5cb14d8dac445c4df4b5f2dc072bed 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -93,7 +93,7 @@ static struct {
 
 static const char turn_off_instructions[] =
 N_("\n"
-   "Disable this message with \"git config advice.%s false\"");
+   "Disable this message with \"git config set advice.%s false\"");
 
 static void vadvise(const char *advice, int display_instructions,
                    const char *key, va_list params)
index 087cb19f4f84f353db26289f97d72f91578fd8c3..4a6ae863bb20c91270814946501fb8a8c541c6d5 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -270,7 +270,7 @@ static int read_graft_file(struct repository *r, const char *graft_file)
                         "to convert the grafts into replace refs.\n"
                         "\n"
                         "Turn this message off by running\n"
-                        "\"git config advice.graftFileDeprecated false\""));
+                        "\"git config set advice.graftFileDeprecated false\""));
        while (!strbuf_getwholeline(&buf, fp, '\n')) {
                /* The format is just "Commit Parent1 Parent2 ...\n" */
                struct commit_graft *graft = read_graft_line(&buf);
diff --git a/hook.c b/hook.c
index 7e90787bca4f7c527175b69f7f912caa85d744f8..faeb01d9ac5ce0920352349f976d4c0b1a337bc2 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -39,7 +39,7 @@ const char *find_hook(const char *name)
                                advise(_("The '%s' hook was ignored because "
                                         "it's not set as executable.\n"
                                         "You can disable this warning with "
-                                        "`git config advice.ignoredHook false`."),
+                                        "`git config set advice.ignoredHook false`."),
                                       path.buf);
                        }
                }
index 527b853ac456cb1ba243106a3a165eec6d247cf8..dc7155c488edc984bbd90648ccd4f469811ad9fd 100644 (file)
@@ -943,7 +943,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
        "\n"
        "where \"$br\" is somehow empty and a 40-hex ref is created. Please\n"
        "examine these refs and maybe delete them. Turn this message off by\n"
-       "running \"git config advice.objectNameWarning false\"");
+       "running \"git config set advice.objectNameWarning false\"");
        struct object_id tmp_oid;
        char *real_ref = NULL;
        int refs_found = 0;
index fac52322a7f6739ce95feea6b527edce00941361..4334766e6dfbf4909d7219500c90ddf3ae8e7929 100755 (executable)
@@ -11,7 +11,7 @@ TEST_PASSES_SANITIZE_LEAK=true
 test_expect_success 'advice should be printed when config variable is unset' '
        cat >expect <<-\EOF &&
        hint: This is a piece of advice
-       hint: Disable this message with "git config advice.nestedTag false"
+       hint: Disable this message with "git config set advice.nestedTag false"
        EOF
        test-tool advise "This is a piece of advice" 2>actual &&
        test_cmp expect actual
index ccfa6a720d090c2f7f2a085f60065bdcfaf8d1d9..a2e9ce03a5e5e6bfcfd8c4828ccc2ec0b29a2d59 100755 (executable)
@@ -1697,7 +1697,7 @@ test_expect_success 'errors if given a bad branch name' '
        cat <<-\EOF >expect &&
        fatal: '\''foo..bar'\'' is not a valid branch name
        hint: See `man git check-ref-format`
-       hint: Disable this message with "git config advice.refSyntax false"
+       hint: Disable this message with "git config set advice.refSyntax false"
        EOF
        test_must_fail git branch foo..bar >actual 2>&1 &&
        test_cmp expect actual
index f92baad1381e6619a311e304865529f3c6dc46e7..6c077f9e9ba13d9b77c38ebab4c70d870fbd3b74 100755 (executable)
@@ -2235,20 +2235,20 @@ test_expect_success 'non-merge commands reject merge commits' '
        error: ${SQ}pick${SQ} does not accept merge commits
        hint: ${SQ}pick${SQ} does not take a merge commit. If you wanted to
        hint: replay the merge, use ${SQ}merge -C${SQ} on the commit.
-       hint: Disable this message with "git config advice.rebaseTodoError false"
+       hint: Disable this message with "git config set advice.rebaseTodoError false"
        error: invalid line 1: pick $oid
        error: ${SQ}reword${SQ} does not accept merge commits
        hint: ${SQ}reword${SQ} does not take a merge commit. If you wanted to
        hint: replay the merge and reword the commit message, use
        hint: ${SQ}merge -c${SQ} on the commit
-       hint: Disable this message with "git config advice.rebaseTodoError false"
+       hint: Disable this message with "git config set advice.rebaseTodoError false"
        error: invalid line 2: reword $oid
        error: ${SQ}edit${SQ} does not accept merge commits
        hint: ${SQ}edit${SQ} does not take a merge commit. If you wanted to
        hint: replay the merge, use ${SQ}merge -C${SQ} on the commit, and then
        hint: ${SQ}break${SQ} to give the control back to you so that you can
        hint: do ${SQ}git commit --amend && git rebase --continue${SQ}.
-       hint: Disable this message with "git config advice.rebaseTodoError false"
+       hint: Disable this message with "git config set advice.rebaseTodoError false"
        error: invalid line 3: edit $oid
        error: cannot squash merge commit into another commit
        error: invalid line 4: fixup $oid
index 411027fb58c7dfb657409980970e71005f2c79c5..6e829f13bf5f0db17f6ca7efe854aae64f7eefd7 100755 (executable)
@@ -178,7 +178,7 @@ test_expect_success 'advice from failed revert' '
        hint: You can instead skip this commit with "git revert --skip".
        hint: To abort and get back to the state before "git revert",
        hint: run "git revert --abort".
-       hint: Disable this message with "git config advice.mergeConflict false"
+       hint: Disable this message with "git config set advice.mergeConflict false"
        EOF
        test_commit --append --no-tag "double-add dream" dream dream &&
        test_must_fail git revert HEAD^ 2>actual &&
index f3947b400a3a89970e400d3c3f5dc5d690292d83..44596cb1e8036c6f7242541346a2e11ac3634d5b 100755 (executable)
@@ -34,7 +34,7 @@ test_expect_success setup '
        git commit --allow-empty --allow-empty-message &&
        git tag empty &&
        git checkout main &&
-       git config advice.detachedhead false
+       git config set advice.detachedhead false
 
 '
 
@@ -60,7 +60,7 @@ test_expect_success 'advice from failed cherry-pick' '
        hint: You can instead skip this commit with "git cherry-pick --skip".
        hint: To abort and get back to the state before "git cherry-pick",
        hint: run "git cherry-pick --abort".
-       hint: Disable this message with "git config advice.mergeConflict false"
+       hint: Disable this message with "git config set advice.mergeConflict false"
        EOF
        test_must_fail git cherry-pick picked 2>actual &&
 
@@ -75,7 +75,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
        error: could not apply \$picked... picked
        hint: after resolving the conflicts, mark the corrected paths
        hint: with 'git add <paths>' or 'git rm <paths>'
-       hint: Disable this message with \"git config advice.mergeConflict false\"
+       hint: Disable this message with \"git config set advice.mergeConflict false\"
        EOF
        test_must_fail git cherry-pick --no-commit picked 2>actual &&
 
index 7eb52b12edc55702f48812725bfddc282297f9a5..66ff9db2702a357ef76204e48303f6929d63c62e 100755 (executable)
@@ -25,7 +25,7 @@ pristine_detach () {
 }
 
 test_expect_success setup '
-       git config advice.detachedhead false &&
+       git config set advice.detachedhead false &&
        echo unrelated >unrelated &&
        git add unrelated &&
        test_commit initial foo a &&
index dd5d92ef302124aeb9d6fe02642489875a9e1b22..dff0b2df9eb89a45a10ee40527ab939c6422bbc7 100755 (executable)
@@ -52,7 +52,7 @@ trailing empty lines
 "
 
 test_expect_success setup '
-       git config advice.detachedhead false &&
+       git config set advice.detachedhead false &&
        echo unrelated >unrelated &&
        git add unrelated &&
        test_commit initial foo a &&
index fcdefba48cc76b9a86c8136342c828e30cd9e811..bab3b1c85d0735eed298a1ac9f10a361859e929c 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success 'setup' "
        hint: If you intend to update such entries, try one of the following:
        hint: * Use the --sparse option.
        hint: * Disable or modify the sparsity rules.
-       hint: Disable this message with \"git config advice.updateSparsePath false\"
+       hint: Disable this message with \"git config set advice.updateSparsePath false\"
        EOF
 
        echo b | cat sparse_error_header - >sparse_entry_b_error &&
index 839c904745a2861487e04363060a951aaeb902c9..7090ed2ef1501874d40d7ed027a59be17c19a65c 100755 (executable)
@@ -32,7 +32,7 @@ test_expect_success 'Test with no pathspecs' '
        cat >expect <<-EOF &&
        Nothing specified, nothing added.
        hint: Maybe you wanted to say ${SQ}git add .${SQ}?
-       hint: Disable this message with "git config advice.addEmptyPathspec false"
+       hint: Disable this message with "git config set advice.addEmptyPathspec false"
        EOF
        git add 2>actual &&
        test_cmp expect actual
@@ -376,7 +376,7 @@ test_expect_success '"git add" a embedded repository' '
                hint:   git rm --cached inner1
                hint:
                hint: See "git help submodule" for more information.
-               hint: Disable this message with "git config advice.addEmbeddedRepo false"
+               hint: Disable this message with "git config set advice.addEmbeddedRepo false"
                warning: adding embedded git repository: inner2
                EOF
                test_cmp expect actual
@@ -414,7 +414,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: Disable this message with "git config advice.addIgnoredFile false"
+hint: Disable this message with "git config set advice.addIgnoredFile false"
 EOF
 cat >expect.out <<\EOF
 add 'track-this'
index 2bade9e804fcfc74df7d5629bbd409fda1c4a302..53a4782267b705b079f12172183cd76fdb0b0960 100755 (executable)
@@ -54,7 +54,7 @@ test_expect_success 'setup' "
        hint: If you intend to update such entries, try one of the following:
        hint: * Use the --sparse option.
        hint: * Disable or modify the sparsity rules.
-       hint: Disable this message with \"git config advice.updateSparsePath false\"
+       hint: Disable this message with \"git config set advice.updateSparsePath false\"
        EOF
 
        echo sparse_entry | cat sparse_error_header - >sparse_entry_error &&
index 57969ce805a54839fe18bfb3bea63faacb1dd85a..5235092c1dbe1fef420d9644ea66470921651da1 100755 (executable)
@@ -33,7 +33,7 @@ test_expect_success 'setup' "
        hint: If you intend to update such entries, try one of the following:
        hint: * Use the --sparse option.
        hint: * Disable or modify the sparsity rules.
-       hint: Disable this message with \"git config advice.updateSparsePath false\"
+       hint: Disable this message with \"git config set advice.updateSparsePath false\"
        EOF
 
        cat >dirty_error_header <<-EOF &&
@@ -46,7 +46,7 @@ test_expect_success 'setup' "
        hint: To correct the sparsity of these paths, do the following:
        hint: * Use \"git add --sparse <paths>\" to update the index
        hint: * Use \"git sparse-checkout reapply\" to apply the sparsity rules
-       hint: Disable this message with \"git config advice.updateSparsePath false\"
+       hint: Disable this message with \"git config set advice.updateSparsePath false\"
        EOF
 "
 
index fa6336edf98350566fd754c9d8d252d27af45e6e..0ff4956869bea4984ba1ac654abc5fef80bfad4b 100755 (executable)
@@ -1896,7 +1896,7 @@ test_expect_success 'recursive tagging should give advice' '
        hint: already a tag. If you meant to tag the object that it points to, use:
        hint:
        hint:   git tag -f nested annotated-v4.0^{}
-       hint: Disable this message with "git config advice.nestedTag false"
+       hint: Disable this message with "git config set advice.nestedTag false"
        EOF
        git tag -m nested nested annotated-v4.0 2>actual &&
        test_cmp expect actual
index 2d984eb4c6a167c3c0f1e072a66aa90fe7b15660..d4cf269431b219d2167e31e26690df21c27e03fb 100755 (executable)
@@ -225,7 +225,7 @@ test_expect_success 'switch to another branch while carrying a deletion' '
 '
 
 test_expect_success 'checkout to detach HEAD (with advice declined)' '
-       git config advice.detachedHead false &&
+       git config set advice.detachedHead false &&
        rev=$(git rev-parse --short renamer^) &&
        git checkout -f renamer &&
        git clean -f &&
@@ -245,7 +245,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
 '
 
 test_expect_success 'checkout to detach HEAD' '
-       git config advice.detachedHead true &&
+       git config set advice.detachedHead true &&
        rev=$(git rev-parse --short renamer^) &&
        git checkout -f renamer &&
        git clean -f &&
index 981488885fba49c57176b8d5054b06ac6bb8f4bc..d6a501d4535417c91723f223a662c8678f507b3f 100755 (executable)
@@ -212,7 +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: Disable this message with "git config advice.addIgnoredFile false"
+               hint: Disable this message with "git config set advice.addIgnoredFile false"
                EOF
                # Does not use test_commit due to the ignore
                echo "*" > .gitignore &&
index 773383fefb50a9ac673b84d89ebd63ba92792d3b..22e310e277e249cf8eed4094050abd9e18fff9ee 100755 (executable)
@@ -1700,7 +1700,7 @@ test_expect_success 'setup slow status advice' '
                EOF
                git add .gitignore &&
                git commit -m "Add .gitignore" &&
-               git config advice.statusuoption true
+               git config set advice.statusuoption true
        )
 '