From 7dfe54656c365050c9287ef0bed809375f702a20 Mon Sep 17 00:00:00 2001 From: Michal Gorecki Date: Fri, 20 Oct 2023 16:51:34 +0200 Subject: [PATCH] Check if final tag exists before trying to find latest rc tag This fixes the issue https://github.com/apache/mynewt-newt/issues/526 --- newt/cli/project_cmds.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/newt/cli/project_cmds.go b/newt/cli/project_cmds.go index 2d5f57f87..92d40a574 100644 --- a/newt/cli/project_cmds.go +++ b/newt/cli/project_cmds.go @@ -72,14 +72,20 @@ func newRunCmd(cmd *cobra.Command, args []string) { NewtUsage(nil, err) } - commit, err := dl.LatestRc(tmpdir, newtutil.NewtBlinkyTag) - if err != nil { - NewtUsage(nil, err) - } - + commit := newtutil.NewtBlinkyTag err = dl.Checkout(tmpdir, commit) + + /* If checkout with final tag fails, try to find latest rc tag */ if err != nil { - NewtUsage(nil, err) + commit, err = dl.LatestRc(tmpdir, newtutil.NewtBlinkyTag) + if err != nil { + NewtUsage(nil, err) + } + + err = dl.Checkout(tmpdir, commit) + if err != nil { + NewtUsage(nil, err) + } } util.StatusMessage(util.VERBOSITY_DEFAULT, "Installing "+