gitea: Git-Hook for update does not get the refname, oldrev, newrev as parameter
- Gitea version (or commit ref): v1.1
- Git version: 2.10.1 (Apple Git-78)
- Operating system: OSX/Ubuntu
- Database (use
[x]):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist:
Description
Hi, I have tested some simple scripts from here:
https://git-scm.com/book/uz/v2/Customizing-Git-An-Example-Git-Enforced-Policy
and put that as update-hook via Git-Hooks->update
#!/usr/bin/env ruby
$refname = ARGV[0]
$oldrev = ARGV[1]
$newrev = ARGV[2]
$user = ENV['USER']
puts "Enforcing Policies..."
puts "(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
But it seems that the ARGV is empty.
Also a very simple
#!/bin/bash
echo "$1 $2 $3"
doesn’t print out anything.
From where in the “hook call” of gitea I will be able to read the refs?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (6 by maintainers)
Commits related to this issue
- Fix git hooks update to receive required arguments. Fixes #2090 * Changed migration calling so that migrations can use models package — committed to lafriks-fork/gitea by lafriks 7 years ago
- Fix git hooks update to receive required arguments. Fixes #2090 (#2095) * Changed migration calling so that migrations can use models package — committed to go-gitea/gitea by lafriks 7 years ago
@TomFreudenberg 1.2 is close enough to be safe on using master, if you have tried it out and have not encountered any issues that are not critical for you
There are no exact date but after few remaining issues are resolved I think it will be released. It could be in a week or two if no critical issues or upgrade migration issues found that can’t be resolved in this time-frame.
Hi @lafriks @lunny
I can confirm that this fix works now!
Thanks a lot Lauris for doing that fast work.
Posted originally from @lafriks
Just checked and hooks seems to work just fine.
pre-receive:
update:
post-receive:
When pushing to repository I get output: