Repository navigation
Commit cb732b4
Hand the pre-push hook's terminal to edg-check-policy [GH #164]
git supplies the refs being pushed on a pre-push hook's standard input,
so the checker cannot inherit that stream and still read the user's
answers to the interactive prompts. Reopening sys.stdin inside the
checker rebound only the Python level object and left file descriptor 0
pointing at git's pipe, and it also required a general purpose tool to
know how git invokes hooks. Open the terminal in the hook instead and
pass it as the child's standard input, which fixes the descriptor for the
whole process tree and keeps that knowledge in the one place that needs
it.
Pushing with no terminal attached previously raised an unhandled OSError
from open('/dev/tty'). The hook now falls back to an empty standard
input, and an unanswerable prompt leaves the finding standing, so such a
push reports its findings instead of failing with a traceback.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent ce68be2 commit cb732b4
2 files changed
Lines changed: 38 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
69 | 88 | | |
70 | 89 | | |
71 | 90 | | |
| |||
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
83 | 105 | | |
84 | 106 | | |
85 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
274 | 273 | | |
275 | 274 | | |
276 | 275 | | |
277 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
285 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| |||
719 | 727 | | |
720 | 728 | | |
721 | 729 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | 730 | | |
734 | 731 | | |
735 | 732 | | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | 733 | | |
740 | 734 | | |
741 | 735 | | |
| |||
0 commit comments