Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/commands/commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ const generateCommitMessageFromGitDiff = async ({
fullGitMojiSpec = false,
skipCommitConfirmation = false
}: GenerateCommitMessageFromGitDiffParams): Promise<void> => {
await assertGitRepo();
const commitGenerationSpinner = spinner();
commitGenerationSpinner.start('Generating the commit message');

try {
await assertGitRepo();
commitGenerationSpinner.start('Generating the commit message');
let commitMessage = await generateCommitMessageByDiff(
diff,
fullGitMojiSpec,
Expand Down Expand Up @@ -226,6 +225,14 @@ export async function commit(
fullGitMojiSpec: boolean = false,
skipCommitConfirmation: boolean = false
) {
try {
await assertGitRepo();
} catch (error) {
const err = error as Error;
outro(`${chalk.red('✖')} ${err?.message || err}`);
process.exit(1);
}

if (isStageAllFlag) {
const changedFiles = await getChangedFiles();

Expand Down