({ files }: { files: string[] })
| 104 | file.includes('.gif'); |
| 105 | |
| 106 | export const getDiff = async ({ files }: { files: string[] }) => { |
| 107 | const gitDir = await getGitDir(); |
| 108 | |
| 109 | const excludedFiles = files.filter(isFileExcludedFromDiff); |
| 110 | |
| 111 | if (excludedFiles.length) { |
| 112 | outro( |
| 113 | `Some files are excluded by default from 'git diff'. No commit messages are generated for this files:\n${excludedFiles.join( |
| 114 | '\n' |
| 115 | )}` |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | const diffableFiles = files.filter((file) => !isFileExcludedFromDiff(file)); |
| 120 | |
| 121 | const { stdout: diff } = await execa( |
| 122 | 'git', |
| 123 | ['diff', '--staged', '--', ...diffableFiles], |
| 124 | { cwd: gitDir } |
| 125 | ); |
| 126 | |
| 127 | return diff; |
| 128 | }; |
| 129 | |
| 130 | export const getGitDir = async (): Promise<string> => { |
| 131 | const { stdout: gitDir } = await execa('git', [ |
no test coverage detected
searching dependent graphs…