mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-05 00:08:14 +00:00
Merge commit 'refs/pull/82995/head' of github.com:microsoft/vscode into pr/82995
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user