Skip to content

Commit 8d1c961

Browse files
committed
NewRepository(): fix path initialization
`git rev-parse --git-dir` returns a relative path. Make it absolute before storing it to the new `Repository`.
1 parent ca03c07 commit 8d1c961

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sizes/git.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"os"
1111
"os/exec"
12+
"path/filepath"
1213
"strconv"
1314
"strings"
1415
)
@@ -82,8 +83,9 @@ func NewRepository(path string) (*Repository, error) {
8283
return nil, err
8384
}
8485
}
86+
gitDir := filepath.Join(path, string(bytes.TrimSpace(out)))
8587
repo := &Repository{
86-
path: string(bytes.TrimSpace(out)),
88+
path: gitDir,
8789
}
8890
return repo, nil
8991
}

0 commit comments

Comments
 (0)