Commit 9bc287a
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 69 | + | |
| 70 | + | |
72 | 71 | | |
73 | | - | |
74 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
109 | 116 | | |
110 | 117 | | |
111 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1105 | 1131 | | |
1106 | 1132 | | |
1107 | 1133 | | |
| |||
1170 | 1196 | | |
1171 | 1197 | | |
1172 | 1198 | | |
1173 | | - | |
| 1199 | + | |
1174 | 1200 | | |
1175 | 1201 | | |
1176 | | - | |
| 1202 | + | |
1177 | 1203 | | |
1178 | 1204 | | |
1179 | 1205 | | |
| |||
1183 | 1209 | | |
1184 | 1210 | | |
1185 | 1211 | | |
1186 | | - | |
| 1212 | + | |
1187 | 1213 | | |
1188 | 1214 | | |
1189 | 1215 | | |
| |||
0 commit comments