-
Notifications
You must be signed in to change notification settings - Fork 329
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
Fix: a bug that causes an error when pushing without setting git remote #396
Conversation
hi, @matscube are you sure there is a bug? I've never seen it. When there is no |
hi, @di-sukharev Even if the remote is not set, the The error can be reproduced by the following operations.
|
but if you set the remote, then this lines work well, no? |
No, I don't think so. (Sorry if I was totally wrong) When the remote is set, When the remote is not set, /* dev branch code */
if (!remotes.length) {
const { stdout } = await execa('git', ['push']);
if (stdout) outro(stdout);
process.exit(0);
}
if (remotes.length === 1 && config?.OCO_GITPUSH !== true) {
// ...
// execute git push
// ...
} else {
// ...
// execute git push
// ...
} |
sorry, i was referring to this lines:
i see. let's merge and thank you very much 🙇 |
please pull the latest dev, fix conflicts, i merge and it will be deployed with #397 |
return | ||
|
||
if (!remotes.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i now get what you mean, but i would keep this lines, especially the if (stdout) outro(stdout);
log, because otherwise user won't see why push
is not working bc of the silent return on line 100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@di-sukharev
If it's an intentional behavior to log an error when no remotes are set, I understand it.
I'll leave it as it is without fixing it.
I don't think the E2E tests related to git push
will be wasted, so I'm thinking of converting this PR to a PR for E2E tests only. Is that okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome idea, lets have the tests 100%
please let me know when you are ready with this, no rush, have a good rest of the weekends ❤️ |
test(utils): refactor prepareEnvironment to use prepareTempDir function for consistency
c80a3f3
to
f0464d4
Compare
I have a question about But when I checked the behavior with the latest version in the following 6 patterns of checking the number of git remote settings and the settings of
In the previous version, it returned early when 8fe8e61#diff-ae7d70033d3bac66c3fb6f289e5de37ff2336967e2a9831ad9654214c12122b6L98-L102 Is this an intentional fix? |
i think you are 100% correct assuming 1.1, 2.1 and 3.1 are bugs, they are.. if you want to fix them — this PR is a good fit for it :) |
…nnecessary operations refactor(commit.ts): simplify condition for single remote check by removing redundant config check
…iable and improve test descriptions
Update the end-to-end tests to reflect the new prompt text "Do you want to run `git push`?" instead of "Choose a remote to push to".
@di-sukharev Fixes
|
* 378: fix hook env (#402) * fix(prepare-commit-msg-hook): update error handling to provide clearer instructions for setting API keys and improve user guidance * Fix: a bug that causes an error when pushing without setting git remote (#396) * refactoring v2 (#408) * 3.2.0 * update deploy commands --------- Co-authored-by: Takanori Matsumoto <matscube@gmail.com>
Description
If git remote is not set,
oco
needs to skip thegit push
process regardless theOCO_GITPUSH
setting.Fix
Error capture