Skip to content

Commit 4744b39

Browse files
TicClickjesseduffield
authored andcommitted
work with absolute paths when invoked with --path
1 parent 2436ff1 commit 4744b39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ func main() {
7171
log.Fatal("--path option is incompatible with the --work-tree and --git-dir options")
7272
}
7373

74-
workTree = repoPath
75-
gitDir = filepath.Join(repoPath, ".git")
74+
absRepoPath, err := filepath.Abs(repoPath)
75+
if err != nil {
76+
log.Fatal(err)
77+
}
78+
workTree = absRepoPath
79+
gitDir = filepath.Join(absRepoPath, ".git")
7680
}
7781

7882
if customConfig != "" {

0 commit comments

Comments
 (0)