# deleting non-existent ref via push

3 messages from 2011-09-23 to 2011-09-24. Participants: Sitaram Chamarty, Junio C Hamano.
Thread: https://gitlist.dev/t/28467

## Sitaram Chamarty, 2011-09-23 05:04

Subject: deleting non-existent ref via push
Message-ID: <CAMK1S_gksrR800yJHSnQWDNeDvD75+3Rp+qRWCuUrQyWmNDMsA@mail.gmail.com>
URL: https://gitlist.dev/e/CAMK1S_gksrR800yJHSnQWDNeDvD75%2B3Rp%2BqRWCuUrQyWmNDMsA%40mail.gmail.com

```
Hello,

Pushing to delete a non-existent ref (git push origin :refs/heads/foo)
works without error, except for a warning that the remote is "Allowing
deletion of corrupt ref".  By "works" I mean all hooks are also
executed.

Is this expected/supported behaviour?  Can I rely on it continuing to
work, especially in terms of executing hooks.

Seem like a great way to "poke" a remote repo into executing hooks
without having to make a dummy change and push :-)

-- 
Sitaram

```

## Junio C Hamano, 2011-09-23 18:16

Subject: Re: deleting non-existent ref via push
Message-ID: <7vmxdvunto.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmxdvunto.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CAMK1S_gksrR800yJHSnQWDNeDvD75+3Rp+qRWCuUrQyWmNDMsA@mail.gmail.com>

```
Sitaram Chamarty <sitaramc@gmail.com> writes:

> Pushing to delete a non-existent ref (git push origin :refs/heads/foo)
> works without error, except for a warning that the remote is "Allowing
> deletion of corrupt ref".  By "works" I mean all hooks are also
> executed.
>
> Is this expected/supported behaviour?  Can I rely on it continuing to
> work, especially in terms of executing hooks.

This most definitely is just "we didn't bother checking the error too
carefully, especially because the result of deleting something that did
not exist in the first place is a no-op; anybody who tries to delete a
non-existing thing is a moron and deserves whatever random result he
gets".

It would be a good idea to tighten it.

```

## Sitaram Chamarty, 2011-09-24 03:11

Subject: Re: deleting non-existent ref via push
Message-ID: <CAMK1S_jjr5Lr1_N1aeTxRiaebdxu5b6Y6LiryMSq6NmfArc=0g@mail.gmail.com>
URL: https://gitlist.dev/e/CAMK1S_jjr5Lr1_N1aeTxRiaebdxu5b6Y6LiryMSq6NmfArc%3D0g%40mail.gmail.com
In-Reply-To: <7vmxdvunto.fsf@alter.siamese.dyndns.org>

```
On Fri, Sep 23, 2011 at 11:46 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Sitaram Chamarty <sitaramc@gmail.com> writes:
>
>> Pushing to delete a non-existent ref (git push origin :refs/heads/foo)
>> works without error, except for a warning that the remote is "Allowing
>> deletion of corrupt ref".  By "works" I mean all hooks are also
>> executed.
>>
>> Is this expected/supported behaviour?  Can I rely on it continuing to
>> work, especially in terms of executing hooks.
>
> This most definitely is just "we didn't bother checking the error too
> carefully, especially because the result of deleting something that did
> not exist in the first place is a no-op; anybody who tries to delete a
> non-existing thing is a moron and deserves whatever random result he

I'd better hide behind the fact that I am only doing it for the
side-effect then ;-)

> gets".
>
> It would be a good idea to tighten it.

Thanks.  I just needed to know if I could rely on it long-term or not.
 I'll find some other way to "poke" a remote repo to run the hooks.

```
