| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fafbdc8 commit 5252136
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,7 +67,9 @@ def hook_path(name: str, git_dir: PathLike) -> str: | |||
| 67 | 67 | def _commit_hook_path(name: str, index: "IndexFile") -> str: | |
| 68 | 68 | """:return: path to the named commit hook, respecting Git's core.hooksPath.""" | |
| 69 | 69 | with index.repo.config_reader() as config: | |
| 70 | - core_items = config.items("core") if config.has_section("core") else [] | ||
| 70 | + core_items = [ | ||
| 71 | + item for section in config.sections() if section.lower() == "core" for item in config.items(section) | ||
| 72 | + ] | ||
| 71 | 73 | hooks_dir = next((value for option, value in reversed(core_items) if option.lower() == "hookspath"), None) | |
| 72 | 74 | ||
| 73 | 75 | if not hooks_dir: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1206,7 +1206,7 @@ def test_pre_commit_hook_respects_core_hooks_path(self, rw_repo): | |||
| 1206 | 1206 | os.chmod(hp, 0o744) | |
| 1207 | 1207 | ||
| 1208 | 1208 | with index.repo.config_writer() as writer: | |
| 1209 | - writer.set_value("core", "HoOkSpAtH", "custom-hooks") | ||
| 1209 | + writer.set_value("CoRe", "HoOkSpAtH", "custom-hooks") | ||
| 1210 | 1210 | ||
| 1211 | 1211 | index.commit("This should run the custom hook") | |
| 1212 | 1212 | output = Path(rw_repo.working_dir, "custom-hook-output.txt").read_text(encoding="utf-8") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments