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

Support for default branch names other than master #87

Closed
mattmccutchen opened this issue Aug 3, 2020 · 3 comments · Fixed by #117
Closed

Support for default branch names other than master #87

mattmccutchen opened this issue Aug 3, 2020 · 3 comments · Fixed by #117
Assignees

Comments

@mattmccutchen
Copy link
Collaborator

mattmccutchen commented Aug 3, 2020

We are about to start seeing a lot more git repositories being created with default branch names other than master or renaming their default branch away from master. At a minimum, braid add with no branch, tag, or revision specified should use the default branch of the upstream repository (as given by its HEAD symref) rather than hard-coding master.

If, in the future, there is a standard way for the upstream repository of an existing mirror to indicate that the branch used by the mirror has been renamed (currently under discussion), Braid could offer to update its configuration. This would mainly be for cleanliness, as it sounds like the plan is that the old name would continue to work. There is probably no need for Braid to have a new mirror mode that automatically follows the upstream default branch as given by the HEAD symref; it doesn't sound like other tools are planning to take that approach.

@olfway
Copy link

olfway commented Jun 14, 2022

Just ran into this bug:

/home/user/chadburn > braid add 'https://github.com/PremoWeb/chadburn.git' chadburn -v
Braid: Executing `git --version` in /home/user/chadburn
Braid: Executing `git rev-parse --is-inside-work-tree` in /home/user/chadburn
Braid: Executing `git rev-parse --show-prefix` in /home/user/chadburn
Braid: Executing `git status` in /home/user/chadburn
Braid: Executing `git rev-parse HEAD` in /home/user/chadburn
Braid: Executing `git add .braids.json` in /home/user/chadburn
Braid: Adding mirror of 'https://github.com/PremoWeb/chadburn.git'.
Braid: Executing `git --version` in /home/user/chadburn
Braid: Executing `git rev-parse --is-inside-work-tree` in /home/user/chadburn
Braid: Executing `git rev-parse --show-prefix` in /home/user/chadburn
Braid: Executing `git config remote.master/braid/chadburn.url` in /home/user/chadburn
Braid: Setup: Mirror 'chadburn' already has a remote. Replacing it (force)
Braid: Executing `git remote rm master/braid/chadburn` in /home/user/chadburn
Braid: Setup: Creating remote for 'chadburn'.
Braid: Executing `git remote add master/braid/chadburn /Users/unlimint/.braid/cache/https___github.com_PremoWeb_chadburn.git` in /home/user/chadburn
Braid: Executing `git config remote.master/braid/chadburn.url` in /home/user/chadburn
Braid: Executing `git fetch` in /home/user/.braid/cache/https___github.com_PremoWeb_chadburn.git
Braid: Executing `git fetch -n master/braid/chadburn` in /home/user/chadburn
Braid: Executing `git rev-parse master/braid/chadburn/master^{commit}` in /home/user/chadburn
Braid: Resetting to '2d5945f'.
Braid: Executing `git reset --hard 2d5945f4109faee2e82dcf2ec3e802b6dd15ca53` in /home/user/chadburn
Braid: Error: unknown revision: master/braid/chadburn/master^{commit}

It wasn't obvious that the problem were with remote branch name

@mattmccutchen mattmccutchen self-assigned this Jun 20, 2022
@mattmccutchen
Copy link
Collaborator Author

I have a fix for the basic case (braid add should use the default branch of the upstream repository) mostly done and will submit a PR soon; it turned out not to be too messy.

AFAIK, the proposal for a standard way for a repository to signal that a branch has been renamed never went anywhere, and in any case, supporting that in Braid would be a low priority for me, so I'll declare it out of scope of this issue.

@mattmccutchen
Copy link
Collaborator Author

Released in Braid 1.1.8. After so much work on infrastructure for future maintainability, it's fun to deliver a small feature for a change.

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

Successfully merging a pull request may close this issue.

2 participants