Re: Getting rid of "hint: Using 'master' as the name for the initial branch." when initializing a repository with pygit
- From
Michal Suchánek <msuchanek@suse.de>
- Date
- Feb 1, 2022, 20:02 UTC
- Message-ID
- <20220201200246.GW3113@kunlun.suse.cz>
- In-Reply-To
- <YfmPiZZ/1RGzzfWE@nand.local>
On Tue, Feb 01, 2022 at 02:52:41PM -0500, Taylor Blau wrote:
Show 14 quoted lines
> On Tue, Feb 01, 2022 at 07:41:28PM +0100, Michal Suchánek wrote: > > 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.
That's the problem - there is no way to pass the configuration when using a library to create a repository.
> > 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.
Yes, that is exactly the option that would do it.
Thanks
Michal