From d7b107cdb4d242386867cb0baf7be28afef6287a Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Mon, 23 Jan 2023 11:07:36 +0300 Subject: [PATCH] fix: Don't join info path with root (#418) Closes https://github.com/evilmartians/lefthook/issues/417 --- CHANGELOG.md | 2 ++ internal/git/repository.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0bf20b6..bc93ac64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +- fix: Don't join info path with root ([#418](https://github.com/evilmartians/lefthook/pull/418)) by @mrexox + ## 1.2.7 (2023-01-10) - fix: Make info dir when it is absent ([#414](https://github.com/evilmartians/lefthook/pull/414)) by @sato11 diff --git a/internal/git/repository.go b/internal/git/repository.go index 27c30515..5d3d2c80 100644 --- a/internal/git/repository.go +++ b/internal/git/repository.go @@ -49,7 +49,7 @@ func NewRepository(fs afero.Fs) (*Repository, error) { if err != nil { return nil, err } - infoPath = filepath.Join(rootPath, infoPath) + infoPath = filepath.Clean(infoPath) if exists, _ := afero.DirExists(fs, infoPath); !exists { err = fs.Mkdir(infoPath, infoDirMode) if err != nil {