File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import React from 'react';
22import { Text , Newline } from 'ink' ;
33import BigText from 'ink-big-text' ;
44import Gradient from 'ink-gradient' ;
5+ import isGit from 'is-git-repository' ;
6+ import isCommitterSet from './utils/errors.js' ;
57import info from './utils/info.js' ;
68import askForCommitMessage from './utils/commit.js' ;
79import { getOpenAIKey , setOpenAIKey , deleteOPenAIKey } from './utils/api.js' ;
@@ -19,7 +21,13 @@ export default function App({flags}) {
1921 console . log ( 'Run `magicc --setopenai=<api-key>` to save your API key and try again.' ) ;
2022 } else {
2123 console . log ( 'You have an OpenAI API key, you can now generate a commit message.' ) ;
22- askForCommitMessage ( ) ;
24+ const gitCheck = isGit ( ) ;
25+ const committerCheck = isCommitterSet ( ) ;
26+ if ( gitCheck && committerCheck ) {
27+ askForCommitMessage ( ) ;
28+ } else {
29+ console . log ( 'This is not a git repository.' ) ;
30+ }
2331 }
2432 return (
2533 < >
You can’t perform that action at this time.
0 commit comments