| 195 | export const findCanonicalGitRoot = createFindCanonicalGitRoot() |
| 196 | |
| 197 | function createFindCanonicalGitRoot(): { |
| 198 | (startPath: string): string | null |
| 199 | cache: typeof resolveCanonicalRoot.cache |
| 200 | } { |
| 201 | function wrapper(startPath: string): string | null { |
| 202 | const root = findGitRoot(startPath) |
| 203 | if (!root) { |
| 204 | return null |
| 205 | } |
| 206 | return resolveCanonicalRoot(root) |
| 207 | } |
| 208 | wrapper.cache = resolveCanonicalRoot.cache |
| 209 | return wrapper |
| 210 | } |
| 211 | |
| 212 | export const gitExe = memoize((): string => { |
| 213 | // Every time we spawn a process, we have to lookup the path. |