File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,10 @@ const generateCommitMessageFromGitDiff = async ({
5252 fullGitMojiSpec = false ,
5353 skipCommitConfirmation = false
5454} : GenerateCommitMessageFromGitDiffParams ) : Promise < void > => {
55- await assertGitRepo ( ) ;
5655 const commitGenerationSpinner = spinner ( ) ;
57- commitGenerationSpinner . start ( 'Generating the commit message' ) ;
58-
5956 try {
57+ await assertGitRepo ( ) ;
58+ commitGenerationSpinner . start ( 'Generating the commit message' ) ;
6059 let commitMessage = await generateCommitMessageByDiff (
6160 diff ,
6261 fullGitMojiSpec ,
@@ -226,6 +225,14 @@ export async function commit(
226225 fullGitMojiSpec : boolean = false ,
227226 skipCommitConfirmation : boolean = false
228227) {
228+ try {
229+ await assertGitRepo ( ) ;
230+ } catch ( error ) {
231+ const err = error as Error ;
232+ outro ( `${ chalk . red ( '✖' ) } ${ err ?. message || err } ` ) ;
233+ process . exit ( 1 ) ;
234+ }
235+
229236 if ( isStageAllFlag ) {
230237 const changedFiles = await getChangedFiles ( ) ;
231238
You can’t perform that action at this time.
0 commit comments