git-r3.eclass: 348: git init --bare || die It doesn't' specify initial branch even if branch is specified through EGIT_BRANCH. This makes the default branch warning noise appear when default branch isn't configured through `git config --global init.defaultBranch`.
Does the actual branch name have any significance?
Probably no but at least it initializes to a valid branch and avoid thr noise.
If you mean if specifying just any branch name is ok, not sure. I preferrably wpuld have ${EGIT_BRANCH:-master}. Globally configured default doesn't really make sense to be applied here since it's about portage.
(In reply to konsolebox from comment #3) > If you mean if specifying just any branch name is ok, not sure. I > preferrably wpuld have ${EGIT_BRANCH:-master}. Globally configured default > doesn't really make sense to be applied here since it's about portage. yeah, seems like this is the easiest fix.
Any decision on this?
I examined the git-r3 code again. I think it's a good idea to initialize a git directory to a more distinguishable name like '__init__'. This way it would be easier to debug a checkout failure.
I'm sorry but I'm a little lost here. What "checkout failure"? Is there another problem here that I'm not aware of? I thought this is merely about silencing the warning. My question was basically whether setting `init.defaultBranch` to an arbitrary value would resolve it, without actually creating any branch.
> I'm sorry but I'm a little lost here. What "checkout failure"? Is there > another problem here that I'm not aware of? I thought this is merely about > silencing the warning. The `git init` command needs to be specified with a branch name to silence the noise and a name needs to be chosen. There's no checkout failure but it will be sensible to initialize the branch with a name that isn't "master" so theoretically a "checkout failure" can easily be debugged without needing to see real commits were pulled on a branch with a similar name as the starting branch. Point is if it's hard to choose an initial branch name for any reason, something like `__init__` will be more ideal than "master" or the one I previously suggested which is ${EGIT_BRANCH:-master}. > My question was basically whether setting `init.defaultBranch` to an > arbitrary value would resolve it, without actually creating any branch. Wouldn't that still create a branch? Adding `-b` will just explicitly specify the name. If you mean resolving the warning by specifying the config, yes it can, but the purpose of this issue report is exactly to avoid that step. Portage needs to be explicit on the initial branch. It used to always initialize with "master" without the warning, and I'm ok with it being explicitly initialized with "master" too, but it's almost a year now and I'm not sure why getting rid of this warning is being avoided so I thought maybe I should suggest a more practical name that might even just by theory help debugging a bit easier. Seriously it's quite simple. Git added a warning for default branches. Git-r3 used "master" for so long so just initialize branches with the "master" name explicitly. If "master" isn't a likeable name, pick something maybe slightly more practical like "__init__".
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf52bf96b61db64d46196192407dcb2e0ef67701 commit cf52bf96b61db64d46196192407dcb2e0ef67701 Author: konsolebox <konsolebox@gmail.com> AuthorDate: 2022-12-14 11:46:53 +0000 Commit: Matt Turner <mattst88@gentoo.org> CommitDate: 2023-07-18 20:51:53 +0000 git-r3.eclass: Use '__init__' as initial branch It silences the default branch warning. Closes: https://bugs.gentoo.org/841392 Signed-off-by: Matt Turner <mattst88@gentoo.org> eclass/git-r3.eclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)