mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Merge commit 'refs/pull/47578/head' of github.com:Microsoft/vscode into pr/47578
This commit is contained in:
@@ -501,6 +501,7 @@ export class Git {
|
||||
export interface Commit {
|
||||
hash: string;
|
||||
message: string;
|
||||
previousHashes: string[];
|
||||
}
|
||||
|
||||
export class GitStatusParser {
|
||||
@@ -631,6 +632,16 @@ export function parseGitmodules(raw: string): Submodule[] {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function parseGitCommit(raw: string): Commit | null {
|
||||
const match = /^([0-9a-f]{40})\n(.*)\n([^]*)$/m.exec(raw.trim());
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const previousHashes = match[2] ? match[2].split(' ') : [];
|
||||
return { hash: match[1], message: match[3], previousHashes };
|
||||
}
|
||||
|
||||
export interface DiffOptions {
|
||||
cached?: boolean;
|
||||
}
|
||||
@@ -928,6 +939,11 @@ export class Repository {
|
||||
await this.run(args);
|
||||
}
|
||||
|
||||
async deleteRef(ref: string): Promise<void> {
|
||||
const args = ['update-ref', '-d', ref];
|
||||
await this.run(args);
|
||||
}
|
||||
|
||||
async merge(ref: string): Promise<void> {
|
||||
const args = ['merge', ref];
|
||||
|
||||
@@ -1342,14 +1358,8 @@ export class Repository {
|
||||
}
|
||||
|
||||
async getCommit(ref: string): Promise<Commit> {
|
||||
const result = await this.run(['show', '-s', '--format=%H\n%B', ref]);
|
||||
const match = /^([0-9a-f]{40})\n([^]*)$/m.exec(result.stdout.trim());
|
||||
|
||||
if (!match) {
|
||||
return Promise.reject<Commit>('bad commit format');
|
||||
}
|
||||
|
||||
return { hash: match[1], message: match[2] };
|
||||
const result = await this.run(['show', '-s', '--format=%H\n%P\n%B', ref]);
|
||||
return parseGitCommit(result.stdout) || Promise.reject<Commit>('bad commit format');
|
||||
}
|
||||
|
||||
async updateSubmodules(paths: string[]): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user