Remove our marker block (and the marker lines) from hook content.
(content: string)
| 89 | |
| 90 | /** Remove our marker block (and the marker lines) from hook content. */ |
| 91 | function stripMarkerBlock(content: string): string { |
| 92 | const lines = content.split('\n'); |
| 93 | const kept: string[] = []; |
| 94 | let inBlock = false; |
| 95 | for (const line of lines) { |
| 96 | const trimmed = line.trim(); |
| 97 | if (trimmed === MARKER_BEGIN) { inBlock = true; continue; } |
| 98 | if (trimmed === MARKER_END) { inBlock = false; continue; } |
| 99 | if (!inBlock) kept.push(line); |
| 100 | } |
| 101 | return kept.join('\n'); |
| 102 | } |
| 103 | |
| 104 | /** Whether a hook body is just a shebang / blank lines (i.e. only ever ours). */ |
| 105 | function isEffectivelyEmpty(content: string): boolean { |
no test coverage detected