8000 Fixed #39, #7 and a typo by DarkSavci · Pull Request #40 · RomanHotsiy/commitgpt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed #39, #7 and a typo #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ suggest 10 commit messages based on the following diff:
{{diff}}
commit messages should:
- follow conventional commits
- message format should be: <type>[scope]: <description>
- message format should be: <type>(scope): <description>

examples:
- fix(authentication): add password regex pattern
Expand Down
18 changes: 11 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function run(diff: string) {
// TODO: we should use a good tokenizer here
const diffTokens = diff.split(" ").length;
if (diffTokens > 2000) {
console.log(`Diff is way too bug. Truncating to 700 tokens. It may help`);
console.log(`Diff is way too big. Truncating to 700 tokens. It may help`);
diff = diff.split(" ").slice(0, 700).join(" ");
}

Expand All @@ -65,17 +65,21 @@ async function run(diff: string) {
});

if (answer.message === CUSTOM_MESSAGE_OPTION) {
execSync("git commit", { stdio: "inherit" });
execSync("git commit", {stdio: "inherit"});
return;
} else {
execSync(`git commit -m '${escapeCommitMessage(answer.message)}'`, {
stdio: "inherit",
});
const commitMessage = escapeCommitMessage(answer.message);
const commitCommand = `git commit -m '${commitMessage}'`;
execSync(commitCommand, {stdio: 'inherit'});
return;
}
} catch (e) {
console.log("Aborted.");
console.log(e);
console.log("Error:", e.message || e);
if (e.status !== null && e.status !== 0) {
console.error("Git commit failed with status code:", e.status);
} else {
console.error("Aborted.");
}
process.exit(1);
}
}
Expand Down
0