Skip to content

Commit

Permalink
Merge commit 'refs/pull/82995/head' of github.com:microsoft/vscode in…
Browse files Browse the repository at this point in the history
…to pr/82995
  • Loading branch information
joaomoreno committed Nov 29, 2019
2 parents 20a1ce7 + 7b1a6c8 commit ba79d4a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ba79d4a

Please sign in to comment.