-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
500 error if PR merge is rejected by pre-receive hook (exit 1) #10322
Comments
Yes that's because pre-receive hooks run on merge, crud and repository creation too The simplest way you can detect internal actions is by looking at the contents of SSH_ORIGINAL_COMMAND. We have however not completely specd out the what contents of this should be and would like to think a bit more carefully about how this should work |
@zeripath @lunny this was labeled as a 'question', but please can you give this second thought? My hook is doing exactly what I intend to do - to prevent pull request merge if appropriate. However the user experience is disaster - 500 error page instead of a nice error message on the top of the pull request page where there is clean explanation (coming from my hook) why the merge was prevented. From my personal point of view I see this as a bug as I have high expectations from gitea :-) But if you say "Enhancement" I would not complain. It just makes a lot of sense to me gitea behaves this way. |
500 should be a bug, we should prompt an error message. |
OK I think we should try to provide the rejection message but the message displayed above is bad - we should not display the real repository path. |
Now the error messages in CRUD actions also clearly need to be sanitised. We should not be exposing the system filepath of the repositories. |
I think we could shamelessly replace |
I've just done that and extended my changes to affect web CRUD too. |
There is very curious bug in Gitea 1.11.3 docker image I can see. If the message provided from One more thing. The message cannot contain HTML anymore. As the whole message is center-aligned multi-line messages are not pretty. In my case I am showing list of commits preventing the merge. You can imagine how funny the list of commits with comments looks like if this is center-aligned. This is definitely minor, but when the bug above is being fixed can you consider to OK case #!/bin/sh
echo -e "Foo" >&2
exit 1
BAD case #!/bin/sh
echo -e "Foo\n" >&2
exit 1
|
@mshgh please try not to message on old bugs - it's very hard to keep up with the amount of notifications on github for gitea so it may get ignored. I'll take a look though. |
Lets discuss message formatting and html in a new issue. |
[x]
):Description
I tried to test pre-receive git hook (by editing via gitea web interface) and setup simple rejection
every direct (again via web interface) file modification is rejected as expected with the error message above. However if I try to merge a pull request I get 500 error page instead.
The text was updated successfully, but these errors were encountered: