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