Skip to content

Commit

Permalink
Issue 191 (#192)
Browse files Browse the repository at this point in the history
* change fatal to warning

* remove directory if not repository

* added error message to warning

* add error around directory removal

* remove repo if initial clone goes wrong
  • Loading branch information
cooperspencer authored Jan 3, 2024
1 parent 477657d commit 46317e7
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
break
}

sub.Warn().
err = os.RemoveAll(repo.Name)
if err != nil {
dir, _ := filepath.Abs(repo.Name)
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}

sub.Warn().Err(err).
Msgf("retry %s from %s", types.Red(x), types.Red(tries))

time.Sleep(5 * time.Second)
Expand All @@ -167,15 +175,30 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
Msg(err.Error())
} else {
if x == tries {
sub.Fatal().
sub.Warn().
Str("repo", repo.Name).
Msg(err.Error())
err = os.RemoveAll(repo.Name)
if err != nil {
dir, _ := filepath.Abs(repo.Name)
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}
break
} else {
os.RemoveAll(repo.Name)
sub.Warn().
Str("repo", repo.Name).
Str("repo", repo.Name).Err(err).
Msgf("retry %s from %s", types.Red(x), types.Red(tries))

err = os.RemoveAll(repo.Name)
if err != nil {
dir, _ := filepath.Abs(repo.Name)
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}

time.Sleep(5 * time.Second)

continue
Expand Down

0 comments on commit 46317e7

Please sign in to comment.