On Sun, Dec 30 2018, Xheroz 128 wrote:

> Currently, I’m doing my Final Year Project that requires a hook that executes 
> automatically on the server side of the repository, before the objects been 
> pulled to the client side, and after the objects have been pushed to the 
> server side, which is "post-receive" hook. The post-receive hook work well 
> for me, but I couldn’t find any hook to be executed immediately before an 
> upload-operation is performed, i.e. before data is sent to the client.
>
> Why Git doesn't have a hook that executed immediately before the data is sent 
> to the client? Any advice on getting this hook or any similar function of the 
> hook?

We do not have such a pre-upload hook, but could have one. There's an
old thread from 2011 detailing some potential downsides:

https://public-inbox.org/git/CAMK1S_jaEWV=f6ihkzw_6u5ncdw0bposnx-03w9bolofeee...@mail.gmail.com/

FWIW I think most servers who find themselves needing such a hook use it
to e.g. log how many fetches a given repository might serve, and end up
instead wrapping git commands in some custom shell.

It's also possible to imagine a much deeper integration for such a hook,
e.g. something that would allow you to implement the functionality of
the uploadpack.* variables and more in your own code, but I don't know
if that's the sort of thing you're imagining.

Reply via email to