Re: bug: update hook failure doesn't prevent local deletion of a branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Andy Parkins <andyparkins@xxxxxxxxx> writes:
> > Summary: when using git-push to delete a remote branch, and that deletion is 
> > disallowed by the update hook, the local tracking branch _is_ deleted.
> 
> Yes, a few months ago with b516968f, "send-pack" started to
> pretend that it turned around and fetched immediately after it
> attempted to push.
> 
> There are two problems with it.  One is this exact problem Andy
> reported.
...
> I think this is correctable without major changes.
> If the remote end refused to update only one of the refs, and
> send-pack as a whole fails, we could refrain from updating
> anything local.

Reasonable.  Probably pretty simple too.

> But another more fundamental issue is that post-update hook on
> the receiving end could do anything it pleases (for example, it
> could try to rebase what was pushed), and at the protocol level
> there is no way to say "you tried to push this SHA-1 but we
> replaced it with this other SHA-1 instead".

You keep raising this argument against the "git-push updates local
refs" feature.  Its not just the post-update hook that could alter
the ref.  Another user could just push behind you (and I mean right
behind you) and either force an update, delete the ref entirely, or
just fast-forward it.  (Its entirely possible that the other user
does have the commit you just pushed, because you had previously
supplied it to them.)  So its actually possible for the ref to have
changed again before you even see the successful update message on
your console.

I don't think it really matters.  Based on the output you see from
git-push on screen you have good reason to believe that the ref
you just pushed to is now at the commit SHA-1 displayed.  For that
reason alone I think it is correct to update the corresponding
tracking branch, because an immediate git-fetch just wastes the
user's time and will (usually) fetch the SHA-1 just pushed.

We should make our repository state reflect the user's internal
mental view of what just happened, especially here, because the
user's mental view is probably correct.

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux