-
-
Notifications
You must be signed in to change notification settings - Fork 375
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 initial commit when git user email is note defined. #207
Fix initial commit when git user email is note defined. #207
Conversation
Hi @knight-bubble thanks for raising the issue & making a PR 🎉. I just found this on stack overflow. Do you think we could use this to set commit email and username if it isn't set ? I was wondering if doing sth along these lines would work:
|
@rkostrzewski I've tried using the "-c" option too, but it seems to not work also it gives a different error, but couldn't figured out which one 😢. |
@rkostrzewski Running you command gives this kind of output: |
a96a56e
to
a7f6e32
Compare
@knight-bubble oh that could be because in the original StackOverflow post there was
I'm kida afraid that if anything throws an error for some reason the global user won't be unset. |
@rkostrzewski You are right. What if instead of using git command, we will set GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL? There should be a way to call spawn with specific env variables. |
@rkostrzewski This seems to work
|
Maybe can simplify that to: await spawn('git', ['commit', '-m', 'initial commit from Preact CLI'], {
cwd,
env: {
GIT_AUTHOR_NAME: gitUser || defaultGitUser,
GIT_AUTHOR_EMAIL: gitEmail || defaultGitEmail
}
}); |
@developit Just tested without GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL. And it doesn't work. |
@knight-bubble sounds great. |
I'm not sure I follow --- why do we need to specify a Git author name/email? If you just removed that, it should work fine, no? I have a few yeoman generators, and in them I just spawn |
@lukeed You are right. But if the user email is not specified, the git initialization function fails.
|
Ah, okay. Does it throw? If so, then a |
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.
LGTM
^ I was a dolt and didn't notice the different vars, ignore me 😅 |
@developit @rkostrzewski @knight-bubble what exactly is stopping us from merging this right away? |
This PR might be effected based on the discussions in #216 |
oh no, This PR mainly fixes the commit author, whereas #216 mainly will just make the auto --git flag as default false. if user still passes |
@rkostrzewski @developit is this good to go? another PR is pending on this |
I am sure the initial message shouldn't be suppressed, and if you know how to display it please tell me.
But that commit at least fixes #202