aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-20 20:12:40 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-21 11:57:45 +0200
commit8a03853869136f4984f7f9e0457cccfaa629b3ea (patch)
tree3d418ba1d5eb998ff4c2901cd6d2f3911c75e1dc /repository/git.go
parentf1949f79eb2051a8a745ed9954629ad344840b6e (diff)
downloadgit-bug-8a03853869136f4984f7f9e0457cccfaa629b3ea.tar.gz
repo: workaround for git returning no path when inside a .git dir
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/repository/git.go b/repository/git.go
index 29417dc7..d01a8e68 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
}