mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Git - timeline provider should handle repository with no commits (#200962)
This commit is contained in:
parent
e8e04769ec
commit
baab9bde4d
|
@ -1109,13 +1109,22 @@ export class Repository {
|
|||
|
||||
args.push('--', uri.fsPath);
|
||||
|
||||
const result = await this.exec(args);
|
||||
if (result.exitCode) {
|
||||
// No file history, e.g. a new file or untracked
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
const result = await this.exec(args);
|
||||
if (result.exitCode) {
|
||||
// No file history, e.g. a new file or untracked
|
||||
return [];
|
||||
}
|
||||
|
||||
return parseGitCommits(result.stdout);
|
||||
return parseGitCommits(result.stdout);
|
||||
} catch (err) {
|
||||
// Repository has no commits yet
|
||||
if (/does not have any commits yet/.test(err.stderr)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async reflog(ref: string, pattern: string): Promise<string[]> {
|
||||
|
|
Loading…
Reference in a new issue