arxanas / git-branchless

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

fix(init): resolve hooks path relative to repo root #1446

Open ethanwu10 opened 1 week ago

ethanwu10 commented 1 week ago

Ensure that core.hooksPath is resolved relative to the repository root of the main worktree, or the git dir if it is bare (git itself uses the same logic for bare repos).

Fixes #1438

ethanwu10 commented 1 week ago

I'm not clear on which worktree core.hooksPath is being read from and where it's supposed to be resolved relative to. If I'm reading the git docs correctly, they should be read from the current worktree regardless of which worktree the config value itself was read from. I'll need to figure out how to test this properly.

arxanas commented 1 week ago

I'm not clear on which worktree core.hooksPath is being read from and where it's supposed to be resolved relative to. If I'm reading the git docs correctly, they should be read from the current worktree regardless of which worktree the config value itself was read from. I'll need to figure out how to test this properly.

I agree with that interpretation of the docs: a relative hook path always needs to be interpreted from the worktree root that the hook is running in (which means that there's not a way to specify a hook path that's relative to the main worktree).