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

Re: Getting rid of "hint: Using 'master' as the name for the initial branch." when initializing a repository with pygit

From
Taylor Blau <me@ttaylorr.com>
Date
Feb 1, 2022, 19:52 UTC
Message-ID
<YfmPiZZ/1RGzzfWE@nand.local>
In-Reply-To
<20220201184128.GT3113@kunlun.suse.cz>
On Tue, Feb 01, 2022 at 07:41:28PM +0100, Michal Suchánek wrote:
Show 10 quoted lines
> I noticed that in some environments the default branch warning is
> displayed and not others because the git version varies.
>
> The warning is just noise in the test log so I would like to avoid it,
> and I would like to find a solution that works for git that predates the
> introduction of this warning and the option to silence it as well as
> the future git versions in which the default is subject to change.
>
> AFAICT there is no clean way to do it. I can set up the global option to
> whatever but I don't want to do that just to run tests.

If you have set the init.defaultBranch configuration, we will suppress the hint you're talking about.

Alternatively, you can make sure that `git init` is invoked with the `-q` (quiet) flag, which suppresses that warning whether or not you have set the init.defaultBranch config.

(Here, I'm assuming that the library you're talking about invokes the git binary and respects its configuration. I'm not sure how much control you have over the flags that get passed down to the git binary, though).

We could also make it possible to suppress just that advice (with another advice.* configuration option), but it seems redundant with the existence of the other two options I discussed above.

Thanks, Taylor

Previous: Michal SuchánekNext: Michal Suchánek
Message 2 of 5 in “Getting rid of "hint: Using 'master' as the name for the initial branch." when initializing a repository with pygit”
  1. Michal SuchánekFeb 1, 2022
  2. Taylor BlauFeb 1, 2022
  3. Michal SuchánekFeb 1, 2022
  4. Taylor BlauFeb 1, 2022
  5. Michal SuchánekFeb 1, 2022

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.