Skip to content

Commit f27183b

Browse files
committed
add error code for git blame
1 parent e5a596b commit f27183b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

extensions/git/src/api/git.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,6 @@ export const enum GitErrorCodes {
216216
WrongCase = 'WrongCase',
217217
CantLockRef = 'CantLockRef',
218218
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches',
219-
PatchDoesNotApply = 'PatchDoesNotApply'
219+
PatchDoesNotApply = 'PatchDoesNotApply',
220+
NoPathFound = 'NoPathFound'
220221
}

extensions/git/src/git.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,10 @@ export class Repository {
12911291

12921292
return result.stdout.trim();
12931293
} catch (err) {
1294+
if (/^fatal: no such path/.test(err.stderr || '')) {
1295+
err.gitErrorCode = GitErrorCodes.NoPathFound;
1296+
}
1297+
12941298
throw err;
12951299
}
12961300
}

0 commit comments

Comments
 (0)