diff options
author | Sebastien Devaux <sebastien.devaux@laposte.net> | 2019-08-24 22:42:25 +0200 |
---|---|---|
committer | Sebastien Devaux <sebastien.devaux@laposte.net> | 2019-08-24 22:42:25 +0200 |
commit | 7e123fbfcae76e3ad188cfa5e98c27adcde8d6d7 (patch) | |
tree | 8dab22f51e01ebf286ba9a9c0cc61244a313586f /repository | |
parent | 91f563da5f508cfcc5dfe6418e2f6333e247ec6e (diff) | |
download | git-bug-7e123fbfcae76e3ad188cfa5e98c27adcde8d6d7.tar.gz |
issue 178: fetch the repo dir with rev-parse --git-dir
Since is returns the .git dir directly, it is not more needed to
concatenate .git.
Diffstat (limited to 'repository')
-rw-r--r-- | repository/git.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/repository/git.go b/repository/git.go index 9ec7905a..c03cf979 100644 --- a/repository/git.go +++ b/repository/git.go @@ -17,8 +17,8 @@ import ( "github.com/MichaelMure/git-bug/util/lamport" ) -const createClockFile = "/.git/git-bug/create-clock" -const editClockFile = "/.git/git-bug/edit-clock" +const createClockFile = "/git-bug/create-clock" +const editClockFile = "/git-bug/edit-clock" // ErrNotARepo is the error returned when the git repo root wan't be found var ErrNotARepo = errors.New("not a git repository") @@ -76,10 +76,11 @@ func NewGitRepo(path string, witnesser Witnesser) (*GitRepo, error) { repo := &GitRepo{Path: path} // Check the repo and retrieve the root path - stdout, err := repo.runGitCommand("rev-parse", "--show-toplevel") + stdout, err := repo.runGitCommand("rev-parse", "--git-dir") - // for some reason, "git rev-parse --show-toplevel" return nothing - // and no error when inside a ".git" dir + // Now dir is fetched with "git rev-parse --git-dir". May be it can + // still return nothing in some cases. Then empty stdout check is + // kept. if err != nil || stdout == "" { return nil, ErrNotARepo } |