testing needed for master/main fix

26 views
Skip to first unread message

Sitaram Chamarty

unread,
Oct 20, 2023, 1:05:25 AM10/20/23
to gito...@googlegroups.com
Hi

There have been a few emails about this at various times in the
past. Latest was some discussion on IRC where someone suggested
adding `--initial-branch=master` to the `git init --bare`, but
I'm not sure I want to close off support for older gits that
don't have that flag for what a non-technical issue.

The attached patch should work under all conditions, but I'd be
happier if at least a couple of others tried it out, especially
on existing gitolite setups.

thanks
sitaram
mm.patch

Amir Yalon

unread,
Oct 20, 2023, 8:29:29 AM10/20/23
to gito...@googlegroups.com
So simple! I did a `git grep -w master` on the code, and indeed all other references are either in subconfigs, in mirroring or in tests.

On Fri, 20 Oct 2023, at 08:05, Sitaram Chamarty wrote:
> + $master =~ s(.*/)();

I think `/` is a valid character in branch names, so maybe change it to:

+ $master =~ s(^refs/heads/)();


BTW, my original suggestion was not to add `--initial-branch=master` to the `git init --bare`, but rather to add an invocation of `git branch -m master` right after `git init --bare`. This approach should be supported back to much older versions of Git.

Sitaram Chamarty

unread,
Oct 20, 2023, 8:46:22 AM10/20/23
to Amir Yalon, gito...@googlegroups.com
On Fri, Oct 20, 2023 at 03:26:26PM +0300, Amir Yalon wrote:
> So simple! I did a `git grep -w master` on the code, and indeed all other references are either in subconfigs, in mirroring or in tests.
>
> On Fri, 20 Oct 2023, at 08:05, Sitaram Chamarty wrote:
> > + $master =~ s(.*/)();
>
> I think `/` is a valid character in branch names, so maybe change it to:

You mean someone will change what used to be "master" to
"foo/bar"? I had not thought of that, but at the same time, it
seems quite a pathological use, not to mention apt to be
confused with remote branches at least in some contexts. Let's
not go overboard here.

> BTW, my original suggestion was not to add `--initial-branch=master` to the `git init --bare`, but rather to add an invocation of `git branch -m master` right after `git init --bare`. This approach should be supported back to much older versions of Git.

I see that now; sorry I missed it somehow in my earlier reading
and picked up on the second line only in my irc backlog.

Yes that might be simpler I guess.

Let's wait to hear some more voices on this patch. Meanwhile,
did you get a chance to *test* this? Did it work?

Amir Yalon

unread,
Oct 20, 2023, 8:52:31 AM10/20/23
to Sitaram Chamarty, gito...@googlegroups.com


On Fri, 20 Oct 2023, at 15:46, Sitaram Chamarty wrote:
> On Fri, Oct 20, 2023 at 03:26:26PM +0300, Amir Yalon wrote:
>> BTW, my original suggestion was not to add `--initial-branch=master` to the `git init --bare`, but rather to add an invocation of `git branch -m master` right after `git init --bare`. This approach should be supported back to much older versions of Git.
>

> Let's wait to hear some more voices on this patch. Meanwhile,
> did you get a chance to *test* this? Did it work?

No, not as part of a `gitolite setup` run. However, I did test that a `git branch -m master` performed right after a `git init --bare --initial-branch=main` produces the desired effect.
Reply all
Reply to author
Forward
0 new messages