chore(package.json): update version to 1.1.18
refactor(commit.ts): rename getStagedGitDiff to getChangedFiles and remove unused import of generateCommitMessageWithChatCompletion refactor(commit.ts): reformat import statements for better readability refactor(commit.ts): reformat code for better readability feat(commit.ts): add support for selecting remote to push to when multiple remotes are available refactor(commit.ts): remove unnecessary code and fix formatting feat(commit.ts): add support for extraArgs parameter in generateCommitMessageFromGitDiff function chore(checkIsLatestVersion.ts): update console message for clarity and readability fix(git.ts): handle empty output from git command fix(git.ts): add -- argument to git diff command to handle file names with leading hyphens refactor(mergeStrings.ts): remove unnecessary whitespace and add missing semicolon
This commit is contained in:
+6
-4
@@ -20,10 +20,10 @@ export const getOpenCommitIgnore = (): Ignore => {
|
||||
|
||||
try {
|
||||
ig.add(readFileSync('.opencommitignore').toString().split('\n'));
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
|
||||
return ig;
|
||||
}
|
||||
};
|
||||
|
||||
export const getStagedFiles = async (): Promise<string[]> => {
|
||||
const { stdout: files } = await execa('git', [
|
||||
@@ -33,11 +33,12 @@ export const getStagedFiles = async (): Promise<string[]> => {
|
||||
'--relative'
|
||||
]);
|
||||
|
||||
if (!files) return [];
|
||||
|
||||
const filesList = files.split('\n');
|
||||
|
||||
|
||||
const ig = getOpenCommitIgnore();
|
||||
const allowedFiles = filesList.filter(file => !ig.ignores(file));
|
||||
const allowedFiles = filesList.filter((file) => !ig.ignores(file));
|
||||
|
||||
if (!allowedFiles) return [];
|
||||
|
||||
@@ -86,6 +87,7 @@ export const getDiff = async ({ files }: { files: string[] }) => {
|
||||
const { stdout: diff } = await execa('git', [
|
||||
'diff',
|
||||
'--staged',
|
||||
'--',
|
||||
...filesWithoutLocks
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user