1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-11-08 12:09:18 +01:00

return false instead of break (#271)

This commit is contained in:
Andreas Wachter 2024-09-04 19:22:15 +02:00 committed by GitHub
parent 818c0cef4e
commit 9e1217eef1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -63,6 +63,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err = os.MkdirAll(l.Path, 0o777); err != nil { if err = os.MkdirAll(l.Path, 0o777); err != nil {
sub.Error(). sub.Error().
Msg(err.Error()) Msg(err.Error())
return false return false
} }
@ -72,6 +73,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil { if err != nil {
sub.Error(). sub.Error().
Msg(err.Error()) Msg(err.Error())
return false return false
} }
@ -90,6 +92,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil { if err != nil {
sub.Error(). sub.Error().
Msg(err.Error()) Msg(err.Error())
return false return false
} }
case repo.Token != "": case repo.Token != "":
@ -122,14 +125,15 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Warn(). sub.Warn().
Str("repo", repo.Name). Str("repo", repo.Name).
Msg(err.Error()) Msg(err.Error())
break
return false
} }
if x == tries { if x == tries {
sub.Warn(). sub.Warn().
Str("repo", repo.Name). Str("repo", repo.Name).
Msg(err.Error()) Msg(err.Error())
break return false
} }
if strings.Contains(err.Error(), "ERR access denied or repository not exported") { if strings.Contains(err.Error(), "ERR access denied or repository not exported") {
@ -137,7 +141,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
Str("repo", repo.Name). Str("repo", repo.Name).
Msgf("%s doesn't exist.", repo.Name) Msgf("%s doesn't exist.", repo.Name)
break return false
} }
if strings.Contains(err.Error(), "remote repository is empty") { if strings.Contains(err.Error(), "remote repository is empty") {
@ -184,31 +188,13 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Warn(). sub.Warn().
Str("repo", repo.Name). Str("repo", repo.Name).
Msg(err.Error()) Msg(err.Error())
/*
err = os.RemoveAll(filepath.Join(l.Path, repo.Name)) return false
if err != nil {
dir, _ := filepath.Abs(filepath.Join(l.Path, repo.Name))
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}
*/
break
} else { } else {
sub.Warn(). sub.Warn().
Str("repo", repo.Name).Err(err). Str("repo", repo.Name).Err(err).
Msgf("retry %s from %s", types.Red(x), types.Red(tries)) Msgf("retry %s from %s", types.Red(x), types.Red(tries))
/*
err = os.RemoveAll(filepath.Join(l.Path, repo.Name))
if err != nil {
dir, _ := filepath.Abs(filepath.Join(l.Path, repo.Name))
sub.Warn().
Str("repo", repo.Name).Err(err).
Msgf("couldn't remove %s", types.Red(dir))
}
*/
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
continue continue
@ -268,6 +254,7 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
sub.Error(). sub.Error().
Str("repo", repo.Name). Str("repo", repo.Name).
Msg(err.Error()) Msg(err.Error())
return false return false
} }
@ -279,7 +266,8 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
if err != nil { if err != nil {
sub.Warn(). sub.Warn().
Str("repo", repo.Name).Msg(err.Error()) Str("repo", repo.Name).Msg(err.Error())
break
return false
} }
keep := []string{} keep := []string{}