GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
I took an initial look at issue #19  but this seems a bit different.
I have to work with a set of pre-commit hooks that display errors in a few lines almost
always. So when something fails due to a pre-commit hook, I can't tell why because all
I am able to read is the first line of all the output (which does not include the actual error).
It seems fugitive is using messages, and when I do check :messages I again see just one
Is there a way to see the whole output of a failure in a hook?
I was using the latest version of the plugin (1.2) so I decided to checkout the latest changes from the
actual repo but I still found the same problem.
I went through the pre-commit hooks and removed all of the echo statements that I found that were not
It seems that whenever a hook is using multiple echo calls to report something (e.g. "Checking foo... pass")
fugitive thinks this is an error (is that a possibility?) I made sure those echo were not returning a specific
shell exit number though.
Once I removed them, I was able to commit without issues.
What sort of output do you see when you invoke GIT_EDITOR=false git commit in the console?
GIT_EDITOR=false git commit
I'm probably doing it wrong, but GIT_EDITOR=false git commit returns:
error: There was a problem with the editor 'false'.
Please supply the message using either -m or -F option.
Nope, that's exactly correct, and it's what :Gcommit looks for. I expected the pre-commit hook to munge it somehow.
I'm getting this same error and I have no hooks at all.
Although strangely, I only get it when I :Gcommit. :Gstatus and then C to commit works fine.
Changing lines 898 and 900 to /bin/false instead of false took care of it. Not sure what that implies in this case really.
Interesting. Is :!echo $PATH missing /bin too?
@alfredodeza might this fix it for you as well?
No, strangely. Both :echo $PATH and :!echo $PATH show that /bin is present. Also /usr/bin/false is symlinked to it and /usr/bin is also in the path.
which false returns "/usr/bin/false" and it does work at a normal prompt.
No idea what's going on in fugitve that was failing.
@tpope this will not fix my problem because /bin/false doesn't exist in my environment. I have false as a shell built-in command and /usr/bin/false
:echo $PATH shows /bin/ and /usr/bin/
Yeah, that's why I haven't blindly merged in such a change. What if you plug in /usr/bin/false instead? It doesn't make sense, but neither does anything @johntyree has reported.
I agree. None of this is making sense. But it didn't make sense to begin with. Why did :Gstatus and then C work but directly using :Gcommit did not? Even after successfully commiting with :Gstatus, :Gcommit still failed immediately.
I would imagine that /usr/bin/false will work for @alfredodeza but you never know. It would probably work here too, but I'm not going to screw with it now that it works again.
I believe I found the problem. My particular situation has nothing to do with false or having missing things in my $PATH.
In the s:Commit function when v:shell_error evaluates to a non-zero exit status, an errorfile is read and then filtered with this line:
let error = get(errors,-2,get(errors,-1,'!'))
Where errors is the result from reading the error file and error is the filtered string from the original array.
Subsequently, it tries to match that filtered error against a few regular expressions. If none of them work the error is thrown:
And later caught, adding the echoerr highlighting which is what I see. But since all the lines of the echo statements where filtered, I get the empty line.
I am not sure what the right procedure is here (I would submit a pull request otherwise). Going through errors and displaying them if nothing happens seems to much tailored to my needs.
Hi. I got the same issue. When i do :Gcommit with some changes staged it just shows an empty bash screen (without any hook output). What would be the correct way to use those hooks with fugitive?