Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Vsevolod Myalitsin <ub4nal@mail.ru>,
	ben.knoble@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH] advice: use global config for default branch name
Date: Thu, 10 Sep 2026 00:33:56 -0400	[thread overview]
Message-ID: <20260910043356.GB241223@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq8q594tvs.fsf@gitster.g>

On Wed, Sep 09, 2026 at 09:23:19PM -0700, Junio C Hamano wrote:

> Surely, and I think we are pretty much on the same page.  Such a
> mechanical rewrite is not too bad.  Here is what I came up with:
> 
>     $ edit tools/coccinelle/advice.cocci
>     $ make coccicheck
>     $ git add -N tools/coccinelle/advice.cocci
>     $ git apply .build/tools/coccinelle/ALL.cocci.patch
>     $ git add -p
> 
>     Some of the hunks I simply accepted with (y), but most of them
>     needed (e)dit to make them presentable; otherwise we ended up
>     with too many overly long lines.
> 
> 
>  tools/coccinelle/advice.cocci |  7 +++++++
>  advice.c                      | 13 ++++---------
>  branch.c                      |  6 +++---
>  builtin/am.c                  |  4 ++--
>  builtin/checkout.c            |  4 ++--
>  builtin/submodule--helper.c   |  4 ++--
>  sequencer.c                   |  9 ++++-----
>  7 files changed, 24 insertions(+), 23 deletions(-)

This misses a few that have more complex conditionals like:

diff --git a/commit.c b/commit.c
index ad26f0b40a..5eedad6a2c 100644
--- a/commit.c
+++ b/commit.c
@@ -290,9 +290,9 @@ static int read_graft_file(struct repository *r, const char *graft_file)
 	struct strbuf buf = STRBUF_INIT;
 	if (!fp)
 		return -1;
-	if (!no_graft_file_deprecated_advice &&
-	    advice_enabled(ADVICE_GRAFT_FILE_DEPRECATED))
-		advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
+	if (!no_graft_file_deprecated_advice)
+		advise_if_enabled(ADVICE_GRAFT_FILE_DEPRECATED,
+			_("Support for <GIT_DIR>/info/grafts is deprecated\n"
 			 "and will be removed in a future Git version.\n"
 			 "\n"
 			 "Please use \"git replace --convert-graft-file\"\n"

But I think the bigger question remains: if we did this, would people
find the extra lines giving the turn-off instructions ugly/overwhelming?
I'm not sure.

-Peff

  reply	other threads:[~2026-09-10  4:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 12:56 [PATCH] advice: use global config for default branch name Vsevolod Myalitsin
2026-09-08 13:35 ` Ben Knoble
2026-09-08 18:56   ` Vsevolod Myalitsin
2026-09-08 14:59     ` Ben Knoble
2026-09-08 19:56       ` R4NC
2026-09-08 16:24         ` D. Ben Knoble
2026-09-08 16:31     ` Junio C Hamano
2026-09-08 21:38       ` Vsevolod Myalitsin
2026-09-08 18:57         ` Junio C Hamano
2026-09-09  6:49           ` R4NC
2026-09-09 15:54           ` Jeff King
2026-09-09 18:51             ` Junio C Hamano
2026-09-09 19:51               ` Jeff King
2026-09-10  4:23                 ` Junio C Hamano
2026-09-10  4:33                   ` Jeff King [this message]
2026-09-10 12:18                     ` Junio C Hamano
2026-09-10 16:31                       ` Jeff King
2026-09-10  4:28                 ` Junio C Hamano
2027-08-29  0:59               ` Vsevolod Myalitsin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910043356.GB241223@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ub4nal@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox