Pass vcs_type in pre-receive hook
pre-receive hook goes through the same internal API endpoint (
internal/allowed) that gates Git and HTTP access.
Because of that, our code to prevent Git access on Mercurial repositories depends on coincidental differences between the two cases (internal hook vs user request): in Heptapod 0.13, the Git HTTP controller is simply absent, and we make a distinction based on protocol to prevent Git SSH access attempts on Mercurial repositories. In !83 (merged), we're doubling that with coincidental knowledge of a payload difference, because we restored Git HTTP access for Heptapod 0.14.
It would be better if Mercurial would simply send a new
vcs_type parameter to the
allowed endpoint: we'd have a cleaner, robuster and easier to maintain separation of cases. With a
git default value, the impact would be very limited on upstream GitLab code (notably no change would be required in Gitaly).
pre-receive hook will eventually be sent by HGitaly rather than py-heptapod.