arxanas / git-branchless

High-velocity, monorepo-scale workflow for Git
Apache License 2.0
3.47k stars 89 forks source link

core.hooksPath not resolved from repository root #1438

Open ethanwu10 opened 2 weeks ago

ethanwu10 commented 2 weeks ago

Description of the bug

If core.hooksPath is a relative path, git branchless init always resolves it relative to the directory in which it was invoked, not relative to the root of the repo like how Git interprets it.

Reproduction:

git init
git config core.hooksPath hooks
mkdir foo
cd foo
git branchless init
ls

Expected behavior

Hooks should have been installed to /hooks in the repo

Actual behavior

Hooks are installed to /foo/hooks (and then ignored by git)

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

git-branchless-opts 0.10.0

Version of git

git version 2.39.5 (Apple Git-154)

arxanas commented 2 weeks ago

Thanks for reporting. I think many git-branchless commands haven't been tested in non-root directories (and actually don't work), and so far it hasn't come up often (at least on the issue tracker).