summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-12-07 01:28:51 +0300
committerIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-12-07 01:28:51 +0300
commite8b44ed3b1960b1eac948fd3e13b7d54aa1be492 (patch)
treed2fae42435d808ab05d03eb95751d1ecfd0483f8
parentgit command handling partially migrated to new style (diff)
downloadgitbatch-e8b44ed3b1960b1eac948fd3e13b7d54aa1be492.tar.gz
app will exit decently if there are no repositories
-rw-r--r--pkg/git/load.go5
-rw-r--r--pkg/gui/gui.go3
2 files changed, 7 insertions, 1 deletions
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