Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename master branch to main or so #1130

Closed
kngwyu opened this issue Aug 31, 2020 · 9 comments · Fixed by #1503
Closed

Rename master branch to main or so #1130

kngwyu opened this issue Aug 31, 2020 · 9 comments · Fixed by #1503

Comments

@kngwyu
Copy link
Member

kngwyu commented Aug 31, 2020

It can cause inconvenience for a while but will be beneficial for this project.
Github provides some references for this:
https://github.com/github/renaming
https://github.blog/changelog/2020-08-26-set-the-default-branch-for-newly-created-repositories/

Though I have to practice renaming in some personal projects.

@davidhewitt
Copy link
Member

What's your intended benefit of doing this?

@davidhewitt
Copy link
Member

davidhewitt commented Aug 31, 2020

Ah, I'd missed this discussion earlier in the year but agree with its points and happy to support the movement: https://dev.to/rhymu8354/git-renaming-the-master-branch-137b

@davidhewitt
Copy link
Member

main sounds like the new standard people are converging on, so that gets my vote

@davidhewitt
Copy link
Member

FWIW I suggest we do this move later in the year when Github releases "seamless move" for the default branch: https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

@roblabla
Copy link
Contributor

Another reason to wait for seamless move: for git dependencies, cargo defaults the branch argument to master. Once renamed, the user will get the frustrating message "failed to find branch master". I think if github automatically redirects git fetch, it should fix the problem.

@davidhewitt
Copy link
Member

Github now supports the seamless move: https://github.blog/changelog/2021-01-19-support-for-renaming-an-existing-branch/

I'll make the renaming at the weekend unless I hear a reason not to! @kngwyu

@roblabla
Copy link
Contributor

May I request either waiting for rust-lang/cargo#9133 to be into stable (which should happen in 1.52, I believe), or alternatively keeping the old master branch around for compatibility with people using pyo3 through git dependencies?

The current behavior of cargo with git dependencies is to assume the default branch is master (instead of using whatever is the default, e.g. HEAD). If the branch is renamed without keeping the old branch, it will break existing git dependencies. Even with github's seamless move, I believe it won't actually be seamless because of cargo's issues.

@davidhewitt
Copy link
Member

So I just tested it the rename with pythonize. Because Github redirects https requests from master to main as part of the seamless rename, this worked seamlessly without breakage:

pythonize = { git = "https://github.com/davidhewitt/pythonize" }

However if I change to use the ssh protocol, e.g.

pythonize = { git = "ssh://[email protected]/davidhewitt/pythonize" }

then indeed cargo build fails because it's still looking for master:

 fatal: couldn't find remote ref refs/heads/master

My personal opinion is that because the https URL will continue to work fine, it's ok for us to proceed. But I will wait for confirmation from someone else, as users on Rust older than 1.52 will not be able to use git ssh dependencies. I doubt many (any?) users are doing this.

@roblabla
Copy link
Contributor

Ah, alright, that sounds fine then. I was under the impression that https clone would have the same problem, but if they work, then there should be no problem! Thanks for checking :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants