* Which blocks belong to the project being installed / removed / checked: the * one naming its root, and — for the work tree's top-level project only — a * block from an older install, which named no root and so synced from the * directory git runs hooks in.
(projectRoot: string)
| 144 | * directory git runs hooks in. |
| 145 | */ |
| 146 | function ownerFor(projectRoot: string): BlockOwner { |
| 147 | const root = rootKey(projectRoot); |
| 148 | let toplevel: string | null | undefined; |
| 149 | return (blockRoot) => { |
| 150 | if (blockRoot !== null) return blockRoot === root; |
| 151 | if (toplevel === undefined) toplevel = gitToplevelKey(projectRoot); |
| 152 | return toplevel === root; |
| 153 | }; |
| 154 | } |
| 155 | |
| 156 | /** The root each marker block in `content` names (null for an older block). */ |
| 157 | function blockRoots(content: string): (string | null)[] { |
no test coverage detected