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

Default branch main instead of master #32

Closed
olanod opened this issue Nov 24, 2020 · 5 comments
Closed

Default branch main instead of master #32

olanod opened this issue Nov 24, 2020 · 5 comments

Comments

@olanod
Copy link

olanod commented Nov 24, 2020

On a freshly created project from github I ran the version command and got error: not allowed to run on branch main because it doesn't match pattern master. Since it will be the default from now on could main be the default instead of master or have both as allowed branches?

@pksunkara
Copy link
Owner

There are quite a few legacy projects which use master and also sometimes new projects that are used with legacy tools. I think #14 once implemented will solve this issue.

@XAMPPRocky
Copy link

Hey, I think cargo-workspaces should allow both main and master by default, so that it can work with both new projects and legacy projects, and very rarely would a project ever have both at the same time. I don't consider #14 to be a solution, as I don't want to have to create a config file for this tool in every project I maintain, just to use the new default naming.

@pksunkara
Copy link
Owner

pksunkara commented Jan 7, 2021

I use https://docs.rs/glob/0.3.0/glob/struct.Pattern.html to match the branch name with a pattern. Unfortunately it doesn't seem like it's possible to provide master|main as the default pattern because the crate doesn't seem to support OR. Any idea on how to proceed?

https://github.com/pksunkara/cargo-workspaces/blob/master/cargo-workspaces/src/utils/git.rs#L96

@XAMPPRocky
Copy link

I think the simplest solution would be to change allow_branch to be Option<String> so that you can detect its presence by a user, and if not given a value, just try both patterns (one after the other) and error if it matches neither.

@pksunkara
Copy link
Owner

5fa9ae5 should work if anyone wants to test.

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

No branches or pull requests

3 participants