From 8a03853869136f4984f7f9e0457cccfaa629b3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Thu, 20 Sep 2018 20:12:40 +0200 Subject: [PATCH] repo: workaround for git returning no path when inside a .git dir --- repository/git.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repository/git.go b/repository/git.go index 29417dc760c02626e8bfd21e5dc37f43d2b33246..d01a8e680ed3d48aa86cb8525cd64d027664b553 100644 --- a/repository/git.go +++ b/repository/git.go @@ -79,7 +79,9 @@ func NewGitRepo(path string, witnesser func(repo *GitRepo) error) (*GitRepo, err // Check the repo and retrieve the root path stdout, err := repo.runGitCommand("rev-parse", "--show-toplevel") - if err != nil { + // for some reason, "git rev-parse --show-toplevel" return nothing + // and no error when inside a ".git" dir + if err != nil || stdout == "" { return nil, ErrNotARepo }