git should open merge editor with detail and description (tag and commit-hash)

This commit is contained in:
Johannes
2022-05-17 13:46:42 +02:00
parent 4182f3b2ad
commit 7a51178618
4 changed files with 61 additions and 13 deletions

View File

@@ -354,7 +354,7 @@ function sanitizePath(path: string): string {
return path.replace(/^([a-z]):\\/i, (_, letter) => `${letter.toUpperCase()}:\\`);
}
const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%B';
const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B';
export interface ICloneOptions {
readonly parentPath: string;
@@ -660,6 +660,7 @@ export interface Commit {
authorName?: string;
authorEmail?: string;
commitDate?: Date;
refNames: string[];
}
export class GitStatusParser {
@@ -790,7 +791,7 @@ export function parseGitmodules(raw: string): Submodule[] {
return result;
}
const commitRegex = /([0-9a-f]{40})\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)(?:\n([^]*?))?(?:\x00)/gm;
const commitRegex = /([0-9a-f]{40})\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)(?:\n([^]*?))?(?:\x00)/gm;
export function parseGitCommits(data: string): Commit[] {
let commits: Commit[] = [];
@@ -801,6 +802,7 @@ export function parseGitCommits(data: string): Commit[] {
let authorDate;
let commitDate;
let parents;
let refNames;
let message;
let match;
@@ -810,7 +812,7 @@ export function parseGitCommits(data: string): Commit[] {
break;
}
[, ref, authorName, authorEmail, authorDate, commitDate, parents, message] = match;
[, ref, authorName, authorEmail, authorDate, commitDate, parents, refNames, message] = match;
if (message[message.length - 1] === '\n') {
message = message.substr(0, message.length - 1);
@@ -825,6 +827,7 @@ export function parseGitCommits(data: string): Commit[] {
authorName: ` ${authorName}`.substr(1),
authorEmail: ` ${authorEmail}`.substr(1),
commitDate: new Date(Number(commitDate) * 1000),
refNames: refNames.split(',').map(s => s.trim())
});
} while (true);