You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/03/23 10:06:00 UTC

[GitHub] utzig commented on a change in pull request #148: Forced reinstall (`install -f`) was always failing

utzig commented on a change in pull request #148: Forced reinstall (`install -f`) was always failing
URL: https://github.com/apache/mynewt-newt/pull/148#discussion_r176687147
 
 

 ##########
 File path: newt/repo/repo.go
 ##########
 @@ -219,12 +219,19 @@ func (r *Repo) checkExists() bool {
 }
 
 func (r *Repo) updateRepo(branchName string) error {
-	dl := r.downloader
-	err := dl.UpdateRepo(r.Path(), branchName)
+	err := r.downloader.UpdateRepo(r.Path(), branchName)
 	if err != nil {
-		return util.FmtNewtError("Error updating \"%s\": %s",
-			r.Name(), err.Error())
+		// If the update failed because the repo directory has been deleted,
+		// clone the repo again.
+		if util.IsNotExist(err) {
+			err = r.downloadRepo(branchName)
+		}
 	}
+	if err != nil {
 
 Review comment:
   Just removing those lines slightly changes the behaviour... following the path of `err != nil` in line 223 might run `downloadRepo` and return `err == nil` in which case it would end up running `util.FmtNewError`...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services