Skip to content

Commit

Permalink
repo: Upgrade: use branch or commit
Browse files Browse the repository at this point in the history
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: 'git@github.com:xyz.git'
  • Loading branch information
jrotkiewicz committed Feb 9, 2022
1 parent 2c82e98 commit 7923009
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions newt/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ func (r *Repo) Upgrade(ver newtutil.RepoVersion) error {
return err
}

if branch := r.downloader.MainBranch(); branch != "" {
commit = branch
}

if err := r.updateRepo(commit); err != nil {
return err
}
Expand Down

0 comments on commit 7923009

Please sign in to comment.