提交 264d6ac8 编写于 作者: J Joao Moreno

💄

上级 28bcf282
......@@ -238,5 +238,6 @@ export const enum GitErrorCodes {
CantLockRef = 'CantLockRef',
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches',
PatchDoesNotApply = 'PatchDoesNotApply',
NoPathFound = 'NoPathFound'
NoPathFound = 'NoPathFound',
UnknownPath = 'UnknownPath',
}
......@@ -801,7 +801,7 @@ export class Repository {
const elements = await this.lsfiles(path);
if (elements.length === 0) {
throw new GitError({ message: 'Error running ls-files' });
throw new GitError({ message: 'Path not known by git', gitErrorCode: GitErrorCodes.UnknownPath });
}
const { mode, object } = elements[0];
......@@ -814,7 +814,7 @@ export class Repository {
const elements = await this.lstree(treeish, path);
if (elements.length === 0) {
throw new GitError({ message: 'Error running ls-files' });
throw new GitError({ message: 'Path not known by git', gitErrorCode: GitErrorCodes.UnknownPath });
}
const { mode, object, size } = elements[0];
......@@ -1134,6 +1134,10 @@ export class Repository {
const details = await this.getObjectDetails('HEAD', path);
mode = details.mode;
} catch (err) {
if (err.gitErrorCode !== GitErrorCodes.UnknownPath) {
throw err;
}
mode = '100644';
add = '--add';
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册