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