From: Sitaram Chamarty Date: Sun, 25 Sep 2011 07:58:31 GMT Subject: Re: [PATCH/RFC 0/2] Teach receive-pack not to run update hook for corrupt/non existent ref Message-ID: In-Reply-To: <1316927182-14212-1-git-send-email-pangyanhan@gmail.com> On Sun, Sep 25, 2011 at 10:36 AM, Pang Yan Han wrote: > Hi list, > > Currently, receive-pack runs the pre-receive, update, post-receive and > post-update hooks during a push to delete corrupt or non-existent refs, eg: > >        git push origin :refs/heads/foo > > where refs/heads/foo is missing from the remote origin. > > The issue is reported here [1] I did not report an issue. I asked if this was expected and could be relied upon. I'm actually happy with the current behaviour because it solves a problem very neatly for me, but before documenting it I wanted to make sure it would not one day disappear. > This is a patch series which teaches receive-pack not to run update hook for > corrupt or non existent refs during a push. > > Patch 1/2 isn't really relevant to the topic. It's just something I stumbled > across while reading the code. It removes a redundant assignment in the is_url > function. > > Patch 2/2 teaches receive-pack not to run update hook for corrupt or non > existent refs. In summary, I reordered the statements in the update function > so that the update hook is not run for corrupt / non existent refs. > > Perhaps this isn't a good enough solution since the pre-receive, post-receive > and post-update hooks are still run. Also the tests aren't exactly good looking. It doesn't make sense to disable only the update hook. And although I did not come right out and say it, it is the post-update that I care about. If that still runs, my "issue" still exists. > Any advice is highly appreciated. Thanks! > > [1] http://thread.gmane.org/gmane.comp.version-control.git/181942 > > Pang Yan Han (2): >  is_url: Remove redundant assignment >  receive-pack: Don't run update hook for corrupt or nonexistent ref > >  builtin/receive-pack.c |   50 +++++++++++++++++++++++++++-------------------- >  t/t5516-fetch-push.sh  |   33 +++++++++++++++++++++++++++++++ >  url.c                  |    1 - >  3 files changed, 62 insertions(+), 22 deletions(-) > > -- > 1.7.7.rc3.2.g29f2e6 > > -- Sitaram