Skip to content

Commit 58399f1

Browse files
authored
Git - truncate the git blame information after 50 characters (microsoft#236279)
1 parent c82097d commit 58399f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extensions/git/src/blame.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ class GitBlameInformationCache {
144144
}
145145

146146
export class GitBlameController {
147+
private readonly _subjectMaxLength = 50;
148+
147149
private readonly _onDidChangeBlameInformation = new EventEmitter<TextEditor>();
148150
public readonly onDidChangeBlameInformation = this._onDidChangeBlameInformation.event;
149151

@@ -169,10 +171,14 @@ export class GitBlameController {
169171
}
170172

171173
formatBlameInformationMessage(template: string, blameInformation: BlameInformation): string {
174+
const subject = blameInformation.subject && blameInformation.subject.length > this._subjectMaxLength
175+
? `${blameInformation.subject.substring(0, this._subjectMaxLength)}\u2026`
176+
: blameInformation.subject;
177+
172178
const templateTokens = {
173179
hash: blameInformation.hash,
174180
hashShort: blameInformation.hash.substring(0, 8),
175-
subject: emojify(blameInformation.subject ?? ''),
181+
subject: emojify(subject ?? ''),
176182
authorName: blameInformation.authorName ?? '',
177183
authorEmail: blameInformation.authorEmail ?? '',
178184
authorDate: new Date(blameInformation.authorDate ?? new Date()).toLocaleString(),

0 commit comments

Comments
 (0)