Merge commit 'refs/pull/82995/head' of github.com:microsoft/vscode into pr/82995

This commit is contained in:
Joao Moreno
2019-11-29 12:06:41 +01:00

View File

@@ -761,9 +761,12 @@ export class Repository {
async log(options?: LogOptions): Promise<Commit[]> {
const maxEntries = options && typeof options.maxEntries === 'number' && options.maxEntries > 0 ? options.maxEntries : 32;
const args = ['log', '-' + maxEntries, `--pretty=format:${COMMIT_FORMAT}%x00%x00`];
const gitResult = await this.run(args);
if (gitResult.exitCode) {
// An empty repo.
let gitResult: IExecutionResult<string>;
try {
gitResult = await this.run(args);
} catch (err) {
// An empty repo
return [];
}
@@ -1163,9 +1166,15 @@ export class Repository {
let mode: string;
let add: string = '';
let treeish: string = '';
const commits = await this.log({ maxEntries: 1 });
if (commits.length > 0) {
treeish = 'HEAD';
}
try {
const details = await this.getObjectDetails('HEAD', path);
const details = await this.getObjectDetails(treeish, path);
mode = details.mode;
} catch (err) {
if (err.gitErrorCode !== GitErrorCodes.UnknownPath) {