Git - use committerDate in the ref picker (#243974)

This commit is contained in:
Ladislau Szomoru
2025-03-19 11:22:05 +01:00
committed by GitHub
parent 3abd5b1466
commit 9bed6c5a5f
2 changed files with 8 additions and 8 deletions

View File

@@ -73,8 +73,8 @@ class RefItem implements QuickPickItem {
}
get description(): string {
if (this.ref.commitDetails?.authorDate) {
return fromNow(this.ref.commitDetails.authorDate, true, true);
if (this.ref.commitDetails?.commitDate) {
return fromNow(this.ref.commitDetails.commitDate, true, true);
}
switch (this.ref.type) {

View File

@@ -1133,7 +1133,7 @@ function parseGitBlame(data: string): BlameInformation[] {
}
const REFS_FORMAT = '%(refname)%00%(objectname)%00%(*objectname)';
const REFS_WITH_DETAILS_FORMAT = `${REFS_FORMAT}%00%(parent)%00%(*parent)%00%(authorname)%00%(*authorname)%00%(authordate:unix)%00%(*authordate:unix)%00%(subject)%00%(*subject)`;
const REFS_WITH_DETAILS_FORMAT = `${REFS_FORMAT}%00%(parent)%00%(*parent)%00%(authorname)%00%(*authorname)%00%(committerdate:unix)%00%(*committerdate:unix)%00%(subject)%00%(*subject)`;
function parseRefs(data: string): Ref[] {
const refRegex = /^(.*)\0([0-9a-f]{40})\0([0-9a-f]{40})?(?:\0(.*)\0(.*)\0(.*)\0(.*)\0(.*)\0(.*)\0(.*)\0(.*))?$/gm;
@@ -1151,8 +1151,8 @@ function parseRefs(data: string): Ref[] {
let tagCommitSubject: string | undefined;
let authorName: string | undefined;
let tagAuthorName: string | undefined;
let authorDate: string | undefined;
let tagAuthorDate: string | undefined;
let committerDate: string | undefined;
let tagCommitterDate: string | undefined;
const refs: Ref[] = [];
@@ -1165,12 +1165,12 @@ function parseRefs(data: string): Ref[] {
break;
}
[, ref, commitHash, tagCommitHash, commitParents, tagCommitParents, authorName, tagAuthorName, authorDate, tagAuthorDate, commitSubject, tagCommitSubject] = match;
[, ref, commitHash, tagCommitHash, commitParents, tagCommitParents, authorName, tagAuthorName, committerDate, tagCommitterDate, commitSubject, tagCommitSubject] = match;
const parents = tagCommitParents || commitParents;
const subject = tagCommitSubject || commitSubject;
const author = tagAuthorName || authorName;
const date = tagAuthorDate || authorDate;
const date = tagCommitterDate || committerDate;
const commitDetails = parents && subject && author && date
? {
@@ -1178,7 +1178,7 @@ function parseRefs(data: string): Ref[] {
message: subject,
parents: parents.split(' '),
authorName: author,
authorDate: date ? new Date(Number(date) * 1000) : undefined,
commitDate: date ? new Date(Number(date) * 1000) : undefined,
refNames: []
} satisfies Commit : undefined;