-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
no git hook executed during "gitea squash and merge" #6003
Comments
From the official documentation on Git Hooks:
Emphasis mine. This explains why it works when you manually do a When the Gitea Server performs a merge, it checks out your repository into a temporary location, runs Line 570 in 7fb09f0
So it looks like there is an actual bug here. I am not sure if we want to support this though, as the error from References:
|
Thanks for your response. Best... |
Can you maybe add some HTTP call to your |
The prereceive and post-receive hooks won't run because the environment variables aren't being set properly. Well aren't being set at all. |
Even in my make upload not clone branch (#5702) they won't run because they don't run in the editor currently. Personally I think they probably should run. See my pr for refactoring the editor to use LFS. That goes almost all the way but doesn't set the final key variable to make them run SSH_ORIGINAL_COMMAND. (Which can be set to anything it just has to be set.) |
@zeripath did you mean your PR will fix this bug? |
Nope, it won't. I meant that as it currently stands it won't because that's current behaviour but I set almost all of the necessary environment variables to make them run. I do think we should probably run the hooks but it looks like they were deliberately set up so that they wouldn't run for internal pushes etc. So, there are two ways of fixing this:
I suspect that they original idea was that we would end up replicating the functionality of the hooks in the internal code, but of course that's code duplication so it gets missed/forgotten. Therefore we should set it so that the hooks are run. |
For clarity; in order for the hooks to be run you need to set the following environment variables:
That means that if you call a git command to commit or push you should probably set:
|
The issue is that our integration tests fail if you set |
Hiho, any update? Do you think somebody could fix this? I'm heavily dependent on git hooks and the code review process. Muchas... |
Does post-receive git hook work with other commands or does it not work at all? |
yes. the current workaround for us to work directly with git commands like
I just cannot enforce merging via gitea gui, thus not using the branch protection. Best Regards |
Yes, but do Git hooks over Gitea GUI not work at all or does only merging over Gitea GUI not work? |
git hooks over gitea gui are not triggered at all. merging works well. |
Well, so apparently that's why my hook doesn't work either. I think it should be clarified in the OP that this issue regards Git hooks in general, which is a big deal. |
I think I'd better take another look at this. The issue was that when I implemented the final environment variable That's likely due to the integration testing environment being too basic and not completely set up. The required variables are listed above if anyone wants to try. |
Does your example from above contain the finalized additions or do parts of those need to be customized for each git hook with specific variables? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
[x]
):Description
running a "squash and merge" in a pull request after an approval does not trigger a git hook post-receive. The git hook script is a bash script provided with "set -x". No corresponding output is found in any logfile.
But the merge is done.
Doing a git merge without gitea+pull request works like a charm.
Screenshots
none.
The text was updated successfully, but these errors were encountered: