From e8b44ed3b1960b1eac948fd3e13b7d54aa1be492 Mon Sep 17 00:00:00 2001 From: Ibrahim Serdar Acikgoz Date: Fri, 7 Dec 2018 01:28:51 +0300 Subject: app will exit decently if there are no repositories --- pkg/git/load.go | 5 +++++ pkg/gui/gui.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/git/load.go b/pkg/git/load.go index 69bff60..e35e1c1 100644 --- a/pkg/git/load.go +++ b/pkg/git/load.go @@ -2,6 +2,8 @@ package git import ( log "github.com/sirupsen/logrus" + + "errors" "sync" ) @@ -39,5 +41,8 @@ func LoadRepositoryEntities(directories []string) (entities []*RepoEntity, err e // wait until the wait counter is zero, this happens if all goroutines have // finished wg.Wait() + if len(entities) == 0 { + return entities, errors.New("There are no git repositories at given path(s)") + } return entities, nil } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index b781ba5..0598383 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -110,7 +110,8 @@ func (gui *Gui) Run() error { } rs, err := git.LoadRepositoryEntities(g_ui.State.Directories) if err != nil { - log.Error("Error while loading repositories.") + g.Close() + log.Fatal(err) return } g_ui.State.Repositories = rs -- cgit v1.2.3