Re: git push tags
- From
Jeff King <peff@peff.net>
- Date
- Oct 29, 2012, 21:35 UTC
- Message-ID
- <20121029213508.GB20513@sigill.intra.peff.net>
- In-Reply-To
- <20121029172330.GC8359@camk.edu.pl>
On Mon, Oct 29, 2012 at 06:23:30PM +0100, Kacper Kornet wrote:
Show 11 quoted lines
> > That patch just blocks non-forced updates to refs/tags/. I think a saner
> > start would be to disallow updating non-commit objects without a force.
> > We already do so for blobs and trees because they are not (and cannot
> > be) fast forwards. The fact that annotated tags are checked for
> > fast-forward seems to me to be a case of "it happens to work that way"
> > and not anything planned. Since such a push drops the reference to the
> > old version of the tag, it should probably require a force.
>
> I'm not sure. Looking at 37fde87 ("Fix send-pack for non-commitish
> tags.") I have an impression that Junio allowed for fast-forward pushes
> of annotated tags on purpose.Hmm. You're right, though I'm not sure I agree with the reasoning of that commit. I'd certainly like to get Junio's input on the subject.
Show 10 quoted lines
> > Then on top of that we can talk about what lightweight tags should do. > > I'm not sure. Following the regular fast-forward rules makes some sense > > to me, because you are never losing objects. But there may be > > complications with updating tags in general because of fetch's rules, > > and we would be better off preventing people from accidentally doing so. > > I think a careful review of fetch's tag rules would be in order before > > making any decision there. > > The problem with the current behaviour is, that one can never be 100% sure > that his push will not overwrite someone else tag.
Yes, although you do know that you are not throwing away history if you do (because it must be a fast forward). Whereas if you have to use "-f" to update a tag, then you have turned off all safety checks. So it is an improvement for one case (creating a tag), but a regression for another (updating an existing tag). I agree that the latter is probably less common, but how much? If virtually nobody is doing it because git-fetch makes the fetching side too difficult, then the regression is probably not a big deal.
-Peff