-
Notifications
You must be signed in to change notification settings - Fork 96
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
repo: Upgrade: use branch or commit #445
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue this PR is trying to solve?
if err != nil { | ||
return err | ||
} | ||
if branch := r.downloader.MainBranch(); branch != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you could just add if branch := r.downloader.MainBranch(); branch == "" {
around the r.CommitFromVer
call block, and avoid the r.updateRepo
copypasta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While doing newt upgrade
the script tries to checkout to 'master' while there is 'main' instead. Now it is possible to use the 'branch: 'main'' in repository.yml file, and it doesn't only allow to fetch properly, but also to checkout.
About the code - you're right, sorry, I am new to 'go', maybe such solution would be better:
func (r *Repo) Upgrade(ver newtutil.RepoVersion) error {
commit, err := r.CommitFromVer(ver)
if err != nil {
return err
}
if branch := r.downloader.MainBranch(); branch != "" {
commit = branch
}
if err := r.updateRepo(commit); err != nil {
return err
}
return nil
}
Let me know. Thank you
@jrotkiewicz Please rebase on latest master. |
f89a46b
to
32a0b39
Compare
While doing newt upgrade the script tries to checkout to 'master' while there is 'main' instead. Now it is possible to use the 'branch: 'main'' in repository.yml file, and it doesn't only allow to fetch properly, but also to checkout. example from repository.yml: repository.xyz: type: git vers: 0.0.0 branch: 'main' url: '[email protected]:xyz.git'
32a0b39
to
7923009
Compare
No description provided.