Address review feedback about hook resolution · gitpython-developers/GitPython@9bc287a · GitHub
Skip to content

Commit 9bc287a

Browse files
codexByron
authored andcommitted
Address review feedback about hook resolution
- Review feedback: resolve core.hooksPath only when configured, avoid an unconditional git rev-parse dependency, and cover relative paths in a non-bare repository. - Read the effective Git configuration directly so unconfigured repositories retain the legacy .git/hooks lookup and configured relative paths resolve from the directory where hooks execute. Exercise both guarantees in the hook tests. - Review feedback: core.hooksPath can point outside index.repo.working_dir, where Path.relative_to() raises on Windows and prevents a valid hook from running. - Build the Bash argument with os.path.relpath so hooks in parent or other absolute locations remain executable. Fall back to the absolute POSIX-form path when Windows cannot form a relative path across drives, and add a focused command-construction regression test.
1 parent 406b98e commit 9bc287a

2 files changed

Lines changed: 46 additions & 13 deletions

File tree

git/index/fun.py

Lines changed: 14 additions & 7 deletions

test/test_index.py

Lines changed: 32 additions & 6 deletions

0 commit comments

Comments
 (0)