diff --git a/src/commands/generateCommitMessage.ts b/src/commands/generateCommitMessage.ts index 0d39ca9c3ea06..a1e7169a27ee7 100644 --- a/src/commands/generateCommitMessage.ts +++ b/src/commands/generateCommitMessage.ts @@ -13,7 +13,7 @@ import { getCommandUri } from './commandBase.utils'; import type { CommandContext } from './commandContext'; export interface GenerateCommitMessageCommandArgs { - repoPath?: string; + repoPath?: string | Uri; source?: Sources; } @@ -27,6 +27,9 @@ export class GenerateCommitMessageCommand extends ActiveEditorCommand { let source: Sources | undefined = args?.source; if (source == null && context.command === GlCommand.GenerateCommitMessageScm) { source = 'scm-input'; + if (context.type === 'scm' && context.scm.rootUri != null) { + args = { ...args, repoPath: context.scm.rootUri }; + } } return this.execute(context.editor, context.uri, { ...args, source: source });