MCPcopy
hub / github.com/desktop/desktop / parseConfigLockFilePathFromError

Function parseConfigLockFilePathFromError

app/src/lib/git/core.ts:430–445  ·  view source on GitHub ↗
(result: IGitResult)

Source from the content-addressed store, hash-verified

428 * output.
429 */
430export function parseConfigLockFilePathFromError(result: IGitResult) {
431 const match = lockFilePathRe.exec(coerceToString(result.stderr))
432
433 if (match === null) {
434 return null
435 }
436
437 // Git on Windows may print the config file path using forward slashes.
438 // Luckily for us forward slashes are not allowed in Windows file or
439 // directory names so we can simply replace any instance of forward
440 // slashes with backslashes.
441 const normalized = __WIN32__ ? match[1].replace('/', '\\') : match[1]
442
443 // https://github.com/git/git/blob/232378479/lockfile.h#L117-L119
444 return Path.resolve(result.path, `${normalized}.lock`)
445}
446
447export function getDescriptionForError(
448 error: DugiteError,

Callers 3

core-test.tsFile · 0.90
PreferencesClass · 0.90
ConfigureGitUserClass · 0.90

Calls 1

coerceToStringFunction · 0.90

Tested by

no test coverage detected