diff --git a/CHANGELOG.md b/CHANGELOG.md index cc148d9..32092bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Refines AI prompts to provide better commit message generation and explanation results +### Fixed + +- Fixes [#3018](https://github.com/gitkraken/vscode-gitlens/issues/3018) - Line blame overlay is broken when commit message contains a `)` + ## [14.5.0] - 2023-11-13 ### Added diff --git a/src/commands/base.ts b/src/commands/base.ts index f695b2d..b60d1ae 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -285,7 +285,8 @@ export abstract class Command implements Disposable { command: Commands | `${Commands.ActionPrefix}${ActionContext['type']}`, args: T, ): string { - return `command:${command}?${encodeURIComponent(JSON.stringify(args))}`; + // Since we are using the command in a markdown link, we need to escape ()'s so they don't get interpreted as markdown + return `command:${command}?${encodeURIComponent(JSON.stringify(args)).replace(/([()])/g, '\\$1')}`; } protected readonly contextParsingOptions: CommandContextParsingOptions = { expectsEditor: false }; diff --git a/src/git/formatters/commitFormatter.ts b/src/git/formatters/commitFormatter.ts index 370e228..27608fb 100644 --- a/src/git/formatters/commitFormatter.ts +++ b/src/git/formatters/commitFormatter.ts @@ -438,7 +438,8 @@ export class CommitFormatter extends Formatter<GitCommit, CommitFormatOptions> { if (arePlusFeaturesEnabled()) { commands += ` [$(gitlens-graph)](${Command.getMarkdownCommandArgsCore<ShowInCommitGraphCommandArgs>( Commands.ShowInCommitGraph, - { ref: getReferenceFromRevision(this._item) }, + // Avoid including the message here, it just bloats the command url + { ref: getReferenceFromRevision(this._item, { excludeMessage: true }) }, )} "Open in Commit Graph")`; } diff --git a/src/git/models/reference.ts b/src/git/models/reference.ts index b6cab92..43fa67a 100644 --- a/src/git/models/reference.ts +++ b/src/git/models/reference.ts @@ -233,20 +233,20 @@ export function getReferenceFromBranch(branch: GitBranchReference) { }); } -export function getReferenceFromRevision(revision: GitRevisionReference) { +export function getReferenceFromRevision(revision: GitRevisionReference, options?: { excludeMessage?: boolean }) { if (revision.refType === 'stash') { return createReference(revision.ref, revision.repoPath, { refType: revision.refType, name: revision.name, number: revision.number, - message: revision.message, + message: options?.excludeMessage ? undefined : revision.message, }); } return createReference(revision.ref, revision.repoPath, { refType: revision.refType, name: revision.name, - message: revision.message, + message: options?.excludeMessage ? undefined : revision.message, }); }