Skip to content

Commit

Permalink
repo: Upgrade: use branch or commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jrotkiewicz committed Oct 7, 2021
1 parent d5bd104 commit f89a46b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions newt/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,19 @@ func (r *Repo) DirtyState() (string, error) {
}

func (r *Repo) Upgrade(ver newtutil.RepoVersion) error {
commit, err := r.CommitFromVer(ver)
if err != nil {
return err
}
if branch := r.downloader.MainBranch(); branch != "" {
if err := r.updateRepo(branch); err != nil {
return err
}
} else {
commit, err := r.CommitFromVer(ver)
if err != nil {
return err
}

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

return nil
Expand Down

0 comments on commit f89a46b

Please sign in to comment.