This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dfe5465 Check if final tag exists before trying to find latest rc tag
7dfe5465 is described below

commit 7dfe54656c365050c9287ef0bed809375f702a20
Author: Michal Gorecki <michal.gore...@codecoup.pl>
AuthorDate: Fri Oct 20 16:51:34 2023 +0200

    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 2d5f57f8..92d40a57 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 "+

Reply via email to