Skip to content

Log githook output #8

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

Closed
kentcdodds opened this issue Aug 10, 2015 · 15 comments
Closed

Log githook output #8

kentcdodds opened this issue Aug 10, 2015 · 15 comments

Comments

@kentcdodds
Copy link
Member

I have a pre-commit hook that runs eslint. I don't see any output from eslint when that is running when using commitizen. Any idea why that is?

@kentcdodds
Copy link
Member Author

Sorry, to be more specific, I see the output when the hook has finished and the commit has succeeded, but I don't see any of the output while it's in progress (like I do when I commit normally).

@jimthedev
Copy link
Member

Hi Kent. Sorry it took me a bit to get back to you. Can you provide your pre-commit hook? In my case, I actually don't see any eslint output when I run git cz regardless of whether it succeeds or fails. Instead am greeted with a generic, relatively unhelpful error (✗ Commit failed. Did you forget to 'git add' your files?) or with a generic success message (✓ Commit succeeded). The only scenario that running git cz will output your eslint info right now is if you have not configured commitizen in package in the current working directory. This is because by default, when commitizen is called but the current working directory repo does not have an adapter set in package.json/.czrc/.cz.js then it should completely remove itself from the scenario and revert to the normal git commit behavior.

Currently the 'user-friendly' :D default is that commitizen will try to commit, wait for the return code and then present a pretty message to the user based on the return code. This means that we're not piping the output of the command in real time. We probably could explore that scenario either by default or first behind a flag.

Again, if you have a scenario where you have a properly configured adapter in a repo and are getting actual eslint output back, I'd love to see it the pre-commit hook. Perhaps mine could be tweaked.

@kentcdodds
Copy link
Member Author

Try out the angular-formly repo.

  • Kent C. Dodds

(Sent from my mobile device, please forgive typos or brevity)
On Aug 29, 2015 7:55 PM, "Jim Cummins" [email protected] wrote:

Hi Kent. Sorry it took me a bit to get back to you. Can you provide your
pre-commit hook? In my case, I actually don't see any eslint output when I
run git cz regardless of whether it succeeds or fails. Instead am greeted
with a generic, relatively unhelpful error (✗ Commit failed. Did you forget
to 'git add' your files?) or with a generic success message (✓ Commit
succeeded). The only scenario that running git cz will output your eslint
info right now is if you have not configured commitizen in package in the
current working directory. This is because by default, when commitizen is
called but the current working directory repo does not have an adapter set
in package.json/.czrc/.cz.js then it should completely remove itself from
the scenario and revert to the normal git commit behavior.

Currently the 'user-friendly' :D default is that commitizen will try to
commit, wait for the return code and then present a pretty message to the
user based on the return code. This means that we're not piping the output
of the command in real time. We probably could explore that scenario either
by default or first behind a flag.

Again, if you have a scenario where you have a properly configured adapter
in a repo and are getting actual eslint output back, I'd love to see it the
pre-commit hook. Perhaps mine could be tweaked.


Reply to this email directly or view it on GitHub
#8 (comment).

@kentcdodds
Copy link
Member Author

Sorry, I misunderstood. I don't have a scenario where things are working
properly... Would love it though.

  • Kent C. Dodds

(Sent from my mobile device, please forgive typos or brevity)
On Aug 29, 2015 7:57 PM, "Kent C. Dodds" [email protected] wrote:

Try out the angular-formly repo.

  • Kent C. Dodds

(Sent from my mobile device, please forgive typos or brevity)
On Aug 29, 2015 7:55 PM, "Jim Cummins" [email protected] wrote:

Hi Kent. Sorry it took me a bit to get back to you. Can you provide your
pre-commit hook? In my case, I actually don't see any eslint output when I
run git cz regardless of whether it succeeds or fails. Instead am
greeted with a generic, relatively unhelpful error (✗ Commit failed. Did
you forget to 'git add' your files?) or with a generic success message (✓
Commit succeeded). The only scenario that running git cz will output your
eslint info right now is if you have not configured commitizen in package
in the current working directory. This is because by default, when
commitizen is called but the current working directory repo does not have
an adapter set in package.json/.czrc/.cz.js then it should completely
remove itself from the scenario and revert to the normal git commit
behavior.

Currently the 'user-friendly' :D default is that commitizen will try to
commit, wait for the return code and then present a pretty message to the
user based on the return code. This means that we're not piping the output
of the command in real time. We probably could explore that scenario either
by default or first behind a flag.

Again, if you have a scenario where you have a properly configured
adapter in a repo and are getting actual eslint output back, I'd love to
see it the pre-commit hook. Perhaps mine could be tweaked.


Reply to this email directly or view it on GitHub
#8 (comment).

@jimthedev
Copy link
Member

I am no longer using the pretty commit messages. Instead cz should output the raw git results. This should help with this although I'll probably have you double check it on release.

@kentcdodds
Copy link
Member Author

👍

@jimthedev
Copy link
Member

Ok, 2.0.2 seems to be the most stable release in the past 24 hours so we can probably check this with it. I can try it out but it might not be until tomomorrow.

@kentcdodds
Copy link
Member Author

You'll notice that it worked :-)

@kentcdodds
Copy link
Member Author

Actually... Sorry.. No, I forgot what I was looking for. The word-wrap problems have been solved, but it's still not printing out the githook output until after the scripts are finished :-(

@jimthedev
Copy link
Member

Alright. Thanks for checking. I'll dig in for 2.1.
On Fri, Oct 16, 2015 at 10:20 AM Kent C. Dodds [email protected]
wrote:

Actually... Sorry.. No, I forgot what I was looking for. The word-wrap
problems have been solved, but it's still not printing out the githook
output until after the scripts are finished :-(


Reply to this email directly or view it on GitHub
#8 (comment).

@jimthedev jimthedev modified the milestones: 2.1.0, 2.0.0 Oct 16, 2015
@jimthedev
Copy link
Member

I just put in a PR to gulp-git. Once that lands I'll be able to get incremental githook output working. Thanks for waiting. stephenlacy/gulp-git#99

@kentcdodds
Copy link
Member Author

Sweet dude! 😎

@jimthedev jimthedev modified the milestones: 2.2.0, 2.1.0 Oct 21, 2015
jimthedev added a commit that referenced this issue Oct 21, 2015
We needed a way to provide incremental progress to the cli as the commit exec command runs. We
needed to land a PR in gulp-git first. This has now landed. This implements an incremental feedback
using the emitData option and does a few dependency updates.

Closes #8 Closes #28 Closes #31 Closes #32 Closes #33
@kentcdodds
Copy link
Member Author

Finally got a chance to test this out. Works perfectly! Thanks!

@jimthedev
Copy link
Member

Glad to hear. Thanks for testing!
On Sat, Oct 24, 2015 at 12:06 AM Kent C. Dodds [email protected]
wrote:

Finally got a chance to test this out. Works perfectly! Thanks!


Reply to this email directly or view it on GitHub
#8 (comment).

@linxiaowu66
Copy link

@jimthedev Hi,
I had read your posts, and I still can not know how can i output the ghooks log to stdout ?

Can you help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants