From 4744b39f038d9e197455dc81a55277e1b1fe0586 Mon Sep 17 00:00:00 2001 From: TicClick Date: Thu, 6 Jan 2022 00:32:20 +0100 Subject: [PATCH] work with absolute paths when invoked with --path --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0b6a97e6445..c6c09714653 100644 --- a/main.go +++ b/main.go @@ -71,8 +71,12 @@ func main() { log.Fatal("--path option is incompatible with the --work-tree and --git-dir options") } - workTree = repoPath - gitDir = filepath.Join(repoPath, ".git") + absRepoPath, err := filepath.Abs(repoPath) + if err != nil { + log.Fatal(err) + } + workTree = absRepoPath + gitDir = filepath.Join(absRepoPath, ".git") } if customConfig != "" {