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

Stop hard-coding 'master' as the default branch #347

Open
dmerejkowsky opened this issue Apr 23, 2022 · 2 comments
Open

Stop hard-coding 'master' as the default branch #347

dmerejkowsky opened this issue Apr 23, 2022 · 2 comments

Comments

@dmerejkowsky
Copy link
Collaborator

dmerejkowsky commented Apr 23, 2022

See #345 for some context.

master is actually hard-coded quite a lot in tsrc code base, which was fine until the transition from master to main started (quite a long time ago actually)

There are a few places where it's easy to remove. See #346 for instance.

One place it's not is in the manifest yaml config.

Three ideas:

1/ change the schema so that you have to specify a branch for each repo

2/ change the schema so you can specify a default branch globally

3/ allow tsrc to operate with repo configuration lacking a branch al together

I think 1/ is pretty reasonable. It's a breaking change, but a small one.

3/ is retro-compatible but it's going to take a lot of work and I'm not sure the complexity is worth it.

2/ is easy but existing manifests will need to get patched quite a lot.

Thoughts ?

@cgestes
Copy link
Contributor

cgestes commented Sep 12, 2022

3 seems like the obvious answer in my opinion. why specify something that other tools find automatically?

@dmerejkowsky
Copy link
Collaborator Author

So ... I went ahead and try implementing 3/ but there's an issue.

But tsrc is not like other tools.

Currently, when we parse the manifest we put master in the Repo.branch attribute if there's no branch set in the manifest.

If we allow Repo.branch to be None we can clone the repo just fine, but we can no longer sync:

* foo : Current branch: 'main' does not match expected branch: 'None'

Now we could have sync NOT check for the current branch but I don't think this is a good idea.


You see, other tools just read the HEAD ref of the remote to get the default branch, but we're not like other tools.

In fact, I think we should not do 3 at all. After all, we use tsrc to make sure all team mates have the same repos cloned at the same relative paths at the same branch, and we want to do this consistently.

Imagine we implement solution 3 and you have an old manifest branch, dating back when HEAD was 'master'. If you change the HEAD to 'main', then the old manifest would break ...

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

2 participants