( gitDir: string, section: string, subsection: string | null, key: string, )
| 18 | * Finds the first matching key under the given section/subsection. |
| 19 | */ |
| 20 | export async function parseGitConfigValue( |
| 21 | gitDir: string, |
| 22 | section: string, |
| 23 | subsection: string | null, |
| 24 | key: string, |
| 25 | ): Promise<string | null> { |
| 26 | try { |
| 27 | const config = await readFile(join(gitDir, 'config'), 'utf-8') |
| 28 | return parseConfigString(config, section, subsection, key) |
| 29 | } catch { |
| 30 | return null |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Parse a config value from an in-memory config string. |
no test coverage detected