From 7923009404eb6b1c9ff5964e03ccd8558b8081bf Mon Sep 17 00:00:00 2001 From: Jakub Date: Thu, 7 Oct 2021 16:37:21 +0200 Subject: [PATCH] repo: Upgrade: use branch or commit 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' --- newt/repo/repo.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/newt/repo/repo.go b/newt/repo/repo.go index 09e0456bdb..e29efacaf9 100644 --- a/newt/repo/repo.go +++ b/newt/repo/repo.go @@ -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 }