Message ID | 20241205122225.1184215-1-bence@ferdinandy.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6c397d01046251b4d26f2aded07a695ada196962 |
Headers | show |
Series | [v2] advice: suggest using subcommand "git config set" | expand |
On Thu, Dec 05, 2024 at 01:21:58PM +0100, Bence Ferdinandy wrote: > 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. Thanks, this version looks good to me! Patrick
On Thu, Dec 05, 2024 at 01:21:58PM +0100, Bence Ferdinandy wrote: > 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. It's very consistent to keep our messages updated with respect to changes in the user interface. So this patch is a step in the right direction. Thanks for working on this. > Change all uses of "git config advice" in the tests to use the > subcommand. Maybe this should be done in a separate patch. > > Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> > --- > > Notes: > For the tests I just indiscriminately ran: > sed -i "s/git config advice\./git config set advice./" t[0-9]*.sh > > v2: - fixed 3 hardcoded "git config advice" type messages > - made the motiviation more explicit > > advice.c | 2 +- > commit.c | 2 +- > hook.c | 2 +- > object-name.c | 2 +- > t/t0018-advice.sh | 2 +- > t/t3200-branch.sh | 2 +- > t/t3404-rebase-interactive.sh | 6 +++--- > t/t3501-revert-cherry-pick.sh | 2 +- > t/t3507-cherry-pick-conflict.sh | 6 +++--- > t/t3510-cherry-pick-sequence.sh | 2 +- > t/t3511-cherry-pick-x.sh | 2 +- > t/t3602-rm-sparse-checkout.sh | 2 +- > t/t3700-add.sh | 6 +++--- > t/t3705-add-sparse-checkout.sh | 2 +- > t/t7002-mv-sparse-checkout.sh | 4 ++-- > t/t7004-tag.sh | 2 +- > t/t7201-co.sh | 4 ++-- > t/t7400-submodule-basic.sh | 2 +- > t/t7508-status.sh | 2 +- > 19 files changed, 27 insertions(+), 27 deletions(-) > > diff --git a/advice.c b/advice.c > index 6b879d805c..f7a5130c2c 100644 > --- 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\""); The main goal of this patch. Good. > > static void vadvise(const char *advice, int display_instructions, > const char *key, va_list params) > diff --git a/commit.c b/commit.c > index cc03a93036..35ab9bead5 100644 > --- a/commit.c > +++ b/commit.c > @@ -276,7 +276,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\"")); OK. However, instead of solidifying this message, perhaps we could take advantage of `advise_if_enabled()` here. That way, we simplify the code a bit while we also automatically get the new help message, which you are already adjusting in advice.c. More on this below. > 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 a9320cb0ce..9ddbdee06d 100644 > --- a/hook.c > +++ b/hook.c > @@ -39,7 +39,7 @@ const char *find_hook(struct repository *r, 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`."), This message is more of a warning than advice. I don't think we want to use the same approach here as above, because: hint: The 'foo' hook was ignored because it's not set as executable. hint: Disable this message with [...] looks weird. So, your change is enough and right. OK. > path.buf); > } > } > diff --git a/object-name.c b/object-name.c > index c892fbe80a..0fa9008b76 100644 > --- a/object-name.c > +++ b/object-name.c > @@ -952,7 +952,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\""); Here, however, I think we should also switch to `advise_if_enabled()`. [...] The rest of the patch looks good. I think it's desirable to separate the changes in the advice messages from the uses of "git config set" in the tests, as I commented at the beginning of this message. But I don't have a strong opinion on it. I'll reply to this message with the changes I've suggested about using `advise_if_enabled()`. If you agree with the changes, feel free to use them as you wish. Rubén Justo (3): advice: enhance `detach_advice()` to `detach_advice_if_enabled()` commit: use `advise_if_enabled()` in `read_graft_file()` object-name: advice to avoid refs that resemble hashes advice.c | 8 +++----- advice.h | 2 +- builtin/checkout.c | 5 ++--- builtin/clone.c | 3 +-- commit.c | 17 +++++++---------- object-name.c | 9 ++++----- t/t1512-rev-parse-disambiguation.sh | 15 ++++++++++++++- 7 files changed, 32 insertions(+), 27 deletions(-)
Thanks for taking a looking and the follow-up patches! On Sun Dec 08, 2024 at 09:08, Rubén Justo <rjusto@gmail.com> wrote: > On Thu, Dec 05, 2024 at 01:21:58PM +0100, Bence Ferdinandy wrote: > >> 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. > > It's very consistent to keep our messages updated with respect to > changes in the user interface. So this patch is a step in the right > direction. Thanks for working on this. > >> Change all uses of "git config advice" in the tests to use the >> subcommand. > > Maybe this should be done in a separate patch. So I was a bit lazy here, since sed changed both the expected test outputs and the usage, so that could certainly be split into two patches to be prudent. > >> >> Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> >> --- >> >> Notes: >> For the tests I just indiscriminately ran: >> sed -i "s/git config advice\./git config set advice./" t[0-9]*.sh >> >> v2: - fixed 3 hardcoded "git config advice" type messages >> - made the motiviation more explicit >> >> advice.c | 2 +- >> commit.c | 2 +- >> hook.c | 2 +- >> object-name.c | 2 +- >> t/t0018-advice.sh | 2 +- >> t/t3200-branch.sh | 2 +- >> t/t3404-rebase-interactive.sh | 6 +++--- >> t/t3501-revert-cherry-pick.sh | 2 +- >> t/t3507-cherry-pick-conflict.sh | 6 +++--- >> t/t3510-cherry-pick-sequence.sh | 2 +- >> t/t3511-cherry-pick-x.sh | 2 +- >> t/t3602-rm-sparse-checkout.sh | 2 +- >> t/t3700-add.sh | 6 +++--- >> t/t3705-add-sparse-checkout.sh | 2 +- >> t/t7002-mv-sparse-checkout.sh | 4 ++-- >> t/t7004-tag.sh | 2 +- >> t/t7201-co.sh | 4 ++-- >> t/t7400-submodule-basic.sh | 2 +- >> t/t7508-status.sh | 2 +- >> 19 files changed, 27 insertions(+), 27 deletions(-) >> >> diff --git a/advice.c b/advice.c >> index 6b879d805c..f7a5130c2c 100644 >> --- 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\""); > > The main goal of this patch. Good. > >> >> static void vadvise(const char *advice, int display_instructions, >> const char *key, va_list params) >> diff --git a/commit.c b/commit.c >> index cc03a93036..35ab9bead5 100644 >> --- a/commit.c >> +++ b/commit.c >> @@ -276,7 +276,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\"")); > > OK. > > However, instead of solidifying this message, perhaps we could take > advantage of `advise_if_enabled()` here. That way, we simplify the > code a bit while we also automatically get the new help message, which > you are already adjusting in advice.c. > > More on this below. > >> 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 a9320cb0ce..9ddbdee06d 100644 >> --- a/hook.c >> +++ b/hook.c >> @@ -39,7 +39,7 @@ const char *find_hook(struct repository *r, 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`."), > > This message is more of a warning than advice. I don't think we want > to use the same approach here as above, because: > > hint: The 'foo' hook was ignored because it's not set as executable. > hint: Disable this message with [...] > > looks weird. > > So, your change is enough and right. OK. > >> path.buf); >> } >> } >> diff --git a/object-name.c b/object-name.c >> index c892fbe80a..0fa9008b76 100644 >> --- a/object-name.c >> +++ b/object-name.c >> @@ -952,7 +952,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\""); > > Here, however, I think we should also switch to `advise_if_enabled()`. > > [...] > > The rest of the patch looks good. I think it's desirable to separate > the changes in the advice messages from the uses of "git config set" > in the tests, as I commented at the beginning of this message. But I > don't have a strong opinion on it. > > I'll reply to this message with the changes I've suggested about using > `advise_if_enabled()`. If you agree with the changes, feel free to > use them as you wish. Imho my patch is a "no-brainer" in that it doesn't really change anything about code or behaviour, while what you sent does, so I think the best way to go with this would be to first just switch to `config set` with already existing stuff and then open up the question of changing them in a more meaningful way. In general of course it seems like a good idea to bring advice messages under one interface, but there's more in there that I don't think I could argue for or against with any confidence. I'll send a v3 with the test usages changes split out. Thanks, Bence
On Mon Dec 09, 2024 at 12:21, Bence Ferdinandy <bence@ferdinandy.com> wrote: > > Thanks for taking a looking and the follow-up patches! > > On Sun Dec 08, 2024 at 09:08, Rubén Justo <rjusto@gmail.com> wrote: >> On Thu, Dec 05, 2024 at 01:21:58PM +0100, Bence Ferdinandy wrote: >> >>> 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. >> >> It's very consistent to keep our messages updated with respect to >> changes in the user interface. So this patch is a step in the right >> direction. Thanks for working on this. >> >>> Change all uses of "git config advice" in the tests to use the >>> subcommand. >> >> Maybe this should be done in a separate patch. > > So I was a bit lazy here, since sed changed both the expected test outputs and > the usage, so that could certainly be split into two patches to be prudent. > >> >>> >>> Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> >>> --- >>> >>> Notes: >>> For the tests I just indiscriminately ran: >>> sed -i "s/git config advice\./git config set advice./" t[0-9]*.sh >>> >>> v2: - fixed 3 hardcoded "git config advice" type messages >>> - made the motiviation more explicit >>> >>> advice.c | 2 +- >>> commit.c | 2 +- >>> hook.c | 2 +- >>> object-name.c | 2 +- >>> t/t0018-advice.sh | 2 +- >>> t/t3200-branch.sh | 2 +- >>> t/t3404-rebase-interactive.sh | 6 +++--- >>> t/t3501-revert-cherry-pick.sh | 2 +- >>> t/t3507-cherry-pick-conflict.sh | 6 +++--- >>> t/t3510-cherry-pick-sequence.sh | 2 +- >>> t/t3511-cherry-pick-x.sh | 2 +- >>> t/t3602-rm-sparse-checkout.sh | 2 +- >>> t/t3700-add.sh | 6 +++--- >>> t/t3705-add-sparse-checkout.sh | 2 +- >>> t/t7002-mv-sparse-checkout.sh | 4 ++-- >>> t/t7004-tag.sh | 2 +- >>> t/t7201-co.sh | 4 ++-- >>> t/t7400-submodule-basic.sh | 2 +- >>> t/t7508-status.sh | 2 +- >>> 19 files changed, 27 insertions(+), 27 deletions(-) >>> >>> diff --git a/advice.c b/advice.c >>> index 6b879d805c..f7a5130c2c 100644 >>> --- 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\""); >> >> The main goal of this patch. Good. >> >>> >>> static void vadvise(const char *advice, int display_instructions, >>> const char *key, va_list params) >>> diff --git a/commit.c b/commit.c >>> index cc03a93036..35ab9bead5 100644 >>> --- a/commit.c >>> +++ b/commit.c >>> @@ -276,7 +276,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\"")); >> >> OK. >> >> However, instead of solidifying this message, perhaps we could take >> advantage of `advise_if_enabled()` here. That way, we simplify the >> code a bit while we also automatically get the new help message, which >> you are already adjusting in advice.c. >> >> More on this below. >> >>> 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 a9320cb0ce..9ddbdee06d 100644 >>> --- a/hook.c >>> +++ b/hook.c >>> @@ -39,7 +39,7 @@ const char *find_hook(struct repository *r, 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`."), >> >> This message is more of a warning than advice. I don't think we want >> to use the same approach here as above, because: >> >> hint: The 'foo' hook was ignored because it's not set as executable. >> hint: Disable this message with [...] >> >> looks weird. >> >> So, your change is enough and right. OK. >> >>> path.buf); >>> } >>> } >>> diff --git a/object-name.c b/object-name.c >>> index c892fbe80a..0fa9008b76 100644 >>> --- a/object-name.c >>> +++ b/object-name.c >>> @@ -952,7 +952,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\""); >> >> Here, however, I think we should also switch to `advise_if_enabled()`. >> >> [...] >> >> The rest of the patch looks good. I think it's desirable to separate >> the changes in the advice messages from the uses of "git config set" >> in the tests, as I commented at the beginning of this message. But I >> don't have a strong opinion on it. >> >> I'll reply to this message with the changes I've suggested about using >> `advise_if_enabled()`. If you agree with the changes, feel free to >> use them as you wish. > > Imho my patch is a "no-brainer" in that it doesn't really change anything about > code or behaviour, while what you sent does, so I think the best way to go with > this would be to first just switch to `config set` with already existing stuff > and then open up the question of changing them in a more meaningful way. In > general of course it seems like a good idea to bring advice messages under one > interface, but there's more in there that I don't think I could argue for or > against with any confidence. > > I'll send a v3 with the test usages changes split out. > > Thanks, > Bence I started to split the commit, but realized that I only updated "git config advice\." to "git config set advice." in the tests. If I split the around five instances of actually using "git config advice" in the code, then it starts to make a lot less sense for why it is only for "advice" and not for all the other uses of "git config" in the tests. So I'm now inclined to think that I either leave the patch as is, or simple just remove the parts that are not updating expected test outcomes and leave updating usage of "git config" in tests for a later as it would likely be a larger effort to clean up everything to use explicit set/get. This cleanup would also only make sense if there are plans to deprecate the old implicit setting syntax at some point. So should I remove the changes to usage in tests or just leave the patch as is? Best, Bence
On Mon, Dec 09, 2024 at 03:46:04PM +0100, Bence Ferdinandy wrote: > I started to split the commit, but realized that I only updated "git config > advice\." to "git config set advice." in the tests. If I split the around five > instances of actually using "git config advice" in the code, then it starts to > make a lot less sense for why it is only for "advice" and not for all the other > uses of "git config" in the tests. If I understand the intention of this series correctly, the main goal is to update the help messages we give to the user on how to disable the advice messages. I think you have addressed that. Updating the tests to use the new UI "git config set advice" sounds in this series, because it's related to the advice machinery. Updating the test suite to use the new "git config" UI seems out of scope, I think. > So I'm now inclined to think that I either > leave the patch as is, or simple just remove the parts that are not updating > expected test outcomes and leave updating usage of "git config" in tests for > a later as it would likely be a larger effort to clean up everything to use > explicit set/get. This cleanup would also only make sense if there are plans to > deprecate the old implicit setting syntax at some point. > > So should I remove the changes to usage in tests or just leave the patch as is? I don't have a strong opinion on this. Since my message, Junio has marked this series to be merged to "next". I can be perfectly happy with the patch as is. On the other hand, perhaps I could send my patches about `advise_if_enabled()`, later, rebuilt on this series once the dust has settled.
On Mon Dec 09, 2024 at 21:35, Rubén Justo <rjusto@gmail.com> wrote: [snip] > > I don't have a strong opinion on this. Since my message, Junio has > marked this series to be merged to "next". I can be perfectly happy > with the patch as is. > > On the other hand, perhaps I could send my patches about > `advise_if_enabled()`, later, rebuilt on this series once the dust has > settled. I think that would be rather worthwhile, since having different mechanism for displaying advice isn't the best for sure. And it seems the patch has indeed made it to "next" recently, so I think it would be safe to rebuild on it now. Thanks, Bence
On 12/11/24 9:52 AM, Bence Ferdinandy wrote: > > On Mon Dec 09, 2024 at 21:35, Rubén Justo <rjusto@gmail.com> wrote: > [snip] >> >> I don't have a strong opinion on this. Since my message, Junio has >> marked this series to be merged to "next". I can be perfectly happy >> with the patch as is. >> >> On the other hand, perhaps I could send my patches about >> `advise_if_enabled()`, later, rebuilt on this series once the dust has >> settled. > > I think that would be rather worthwhile, since having different mechanism for > displaying advice isn't the best for sure. Indeed. > And it seems the patch has indeed > made it to "next" recently, so I think it would be safe to rebuild on it now. Yes. I'll wait a few days, and then I'll send it. Thanks.
diff --git a/advice.c b/advice.c index 6b879d805c..f7a5130c2c 100644 --- 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) diff --git a/commit.c b/commit.c index cc03a93036..35ab9bead5 100644 --- a/commit.c +++ b/commit.c @@ -276,7 +276,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 a9320cb0ce..9ddbdee06d 100644 --- a/hook.c +++ b/hook.c @@ -39,7 +39,7 @@ const char *find_hook(struct repository *r, 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); } } diff --git a/object-name.c b/object-name.c index c892fbe80a..0fa9008b76 100644 --- a/object-name.c +++ b/object-name.c @@ -952,7 +952,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; diff --git a/t/t0018-advice.sh b/t/t0018-advice.sh index 9a3db02fde..f68e08d0b1 100755 --- a/t/t0018-advice.sh +++ b/t/t0018-advice.sh @@ -10,7 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 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 diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 2295db3dcb..a3a21c54cf 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -1696,7 +1696,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 diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index b11f04eb33..ecfc02062c 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -2258,20 +2258,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 diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 17a9937962..78b03d769d 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -177,7 +177,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 && diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index f3947b400a..44596cb1e8 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -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 && diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh index 7eb52b12ed..66ff9db270 100755 --- a/t/t3510-cherry-pick-sequence.sh +++ b/t/t3510-cherry-pick-sequence.sh @@ -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 && diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh index 84a587daf3..98ef13f0a3 100755 --- a/t/t3511-cherry-pick-x.sh +++ b/t/t3511-cherry-pick-x.sh @@ -51,7 +51,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 && diff --git a/t/t3602-rm-sparse-checkout.sh b/t/t3602-rm-sparse-checkout.sh index 08580fd3dc..02c7acd617 100755 --- a/t/t3602-rm-sparse-checkout.sh +++ b/t/t3602-rm-sparse-checkout.sh @@ -20,7 +20,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 && diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 4c543a1a7e..df580a5806 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -31,7 +31,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 @@ -375,7 +375,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 @@ -413,7 +413,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' diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh index 2bade9e804..53a4782267 100755 --- a/t/t3705-add-sparse-checkout.sh +++ b/t/t3705-add-sparse-checkout.sh @@ -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 && diff --git a/t/t7002-mv-sparse-checkout.sh b/t/t7002-mv-sparse-checkout.sh index 26582ae4e5..4d3f221224 100755 --- a/t/t7002-mv-sparse-checkout.sh +++ b/t/t7002-mv-sparse-checkout.sh @@ -32,7 +32,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 && @@ -45,7 +45,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 " diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index b1316e62f4..7cd5e16dc8 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1850,7 +1850,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 diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 793da6e64e..9bcf7c0b40 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -224,7 +224,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 && @@ -244,7 +244,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 && diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 981488885f..d6a501d453 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -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 && diff --git a/t/t7508-status.sh b/t/t7508-status.sh index f9a5c98f3f..b2070d4e39 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -1699,7 +1699,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 ) '
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> --- Notes: For the tests I just indiscriminately ran: sed -i "s/git config advice\./git config set advice./" t[0-9]*.sh v2: - fixed 3 hardcoded "git config advice" type messages - made the motiviation more explicit advice.c | 2 +- commit.c | 2 +- hook.c | 2 +- object-name.c | 2 +- t/t0018-advice.sh | 2 +- t/t3200-branch.sh | 2 +- t/t3404-rebase-interactive.sh | 6 +++--- t/t3501-revert-cherry-pick.sh | 2 +- t/t3507-cherry-pick-conflict.sh | 6 +++--- t/t3510-cherry-pick-sequence.sh | 2 +- t/t3511-cherry-pick-x.sh | 2 +- t/t3602-rm-sparse-checkout.sh | 2 +- t/t3700-add.sh | 6 +++--- t/t3705-add-sparse-checkout.sh | 2 +- t/t7002-mv-sparse-checkout.sh | 4 ++-- t/t7004-tag.sh | 2 +- t/t7201-co.sh | 4 ++-- t/t7400-submodule-basic.sh | 2 +- t/t7508-status.sh | 2 +- 19 files changed, 27 insertions(+), 27 deletions(-)