git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] advice: use global config for default branch name

From
Jeff King <peff@peff.net>
Date
Sep 10, 2026, 04:33 UTC
Message-ID
<20260910043356.GB241223@coredump.intra.peff.net>
In-Reply-To
<xmqq8q594tvs.fsf@gitster.g>
On Wed, Sep 09, 2026 at 09:23:19PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 19 in “advice: use global config for default branch name”
  1. advice: use global config for default branch nameVsevolod Myalitsin, Sep 7, 2026
  2. Ben KnobleSep 8, 2026
  3. advice: use global config for default branch nameVsevolod Myalitsin, Sep 8, 2026
  4. Ben KnobleSep 8, 2026
  5. R4NCSep 8, 2026
  6. D. Ben KnobleSep 8, 2026
  7. Junio C HamanoSep 8, 2026
  8. advice: use global config for default branch nameVsevolod Myalitsin, Sep 8, 2026
  9. Junio C HamanoSep 8, 2026
  10. R4NCSep 9, 2026
  11. Jeff KingSep 9, 2026
  12. Junio C HamanoSep 9, 2026
  13. Jeff KingSep 9, 2026
  14. Junio C HamanoSep 10, 2026
  15. Jeff KingSep 10, 2026
  16. Junio C HamanoSep 10, 2026
  17. Jeff KingSep 10, 2026
  18. Junio C HamanoSep 10, 2026
  19. Vsevolod MyalitsinAug 29, 2027

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.