{"thread":{"id":"43514","subject":"Re: can I remove or move a tag in a remote repository?","startedAt":"2006-11-19T18:42:53Z","lastAt":"2006-11-29T13:46:40Z","messageCount":9,"participants":["Jakub Narebski","Johannes Schindelin","Jim Meyering","Andreas Ericsson","Andy Whitcroft","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"297241","messageId":"87wt5rffbm.fsf@rho.meyering.net","threadId":"43514","inReplyTo":null,"subject":"can I remove or move a tag in a remote repository?","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2006-11-19T18:42:53Z","receivedAt":"2006-11-19T18:42:53Z","isPatch":false,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Hello,\n\nPeriodically, I sync the coreutils git repository to an otherwise\nread-only CVS repo, and use a cheap git tag named \"cvs-head\" to keep\ntrack of the point to which the latest sync operation has run.\nThen, after every sync-git-to-cvs operation, I run this:\n\n  git-tag -f -m \"most recent version that has been sync'd to cvs\" cvs-head $sha1\n\nAlso periodically, I push my git working dir/repo to a public place,\n\n  http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=summary\n\n-----------------\nJust today, I have finally pushed tags to that public repo, including the\n\"cvs-head\" one (before there were no tags in the remote repo).  But now,\nI've just done a local sync-to-cvs operation, which has resulted in\nmoving that tag to point to a different point in the git repo.\n\nHere's the problem:\nWhen I try to push the new tags, git-push fails:\n\n  $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master\n  updating 'refs/tags/cvs-head'\n    from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100\n    to   db18f53ffb221e9957124d8af81c11a7e350ac3b\n  ...\n  Total 1, written 1 (delta 0), reused 0 (delta 0)\n  Unpacking 1 objects\n  error: denying non-fast forward; you should pull first\n\nI get the same error also when using --force.\n\nPerhaps I shouldn't push the cvs-head tag at all.\nA few questions:\n  - is there a way to say \"push all tags matching /COREUTILS-*/\"\n      or to say \"push all tags, except the ones on this list\"?\n  - is there a way to remove the cvs-head tag from the remote directory?\n      Note: I don't have shell access there.  I can request that someone\n      with shell access do it, but shouldn't have to resort to that.\n  - is there some way to make \"git push\" do what I want, and update the\n      offending tag in the remote repo?\n\nThanks for listening,\n\n"},{"id":"295231","messageId":"ejq96b$frg$1@sea.gmane.org","threadId":"43514","inReplyTo":"87wt5rffbm.fsf@rho.meyering.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-19T18:54:27Z","receivedAt":"2006-11-19T18:54:27Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jim Meyering wrote:\n\n> When I try to push the new tags, git-push fails:\n> \n>   $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master\n>   updating 'refs/tags/cvs-head'\n>     from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100\n>     to   db18f53ffb221e9957124d8af81c11a7e350ac3b\n>   ...\n>   Total 1, written 1 (delta 0), reused 0 (delta 0)\n>   Unpacking 1 objects\n>   error: denying non-fast forward; you should pull first\n> \n> I get the same error also when using --force.\n\nPossibly remote side has receive.denyNonFastForwards set (it should not\nI think if it is public published bare repository). But even then there\nshould be no fast-forward check on tags...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"297333","messageId":"456C1891.80706@op5.se","threadId":"43514","inReplyTo":"87wt5rffbm.fsf@rho.meyering.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-11-28T11:08:01Z","receivedAt":"2006-11-28T11:08:01Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Jim Meyering wrote:\n> \n> Perhaps I shouldn't push the cvs-head tag at all.\n\nPossibly not, although it's nice to let others that use git to know \nwhere you've cut the release.\n\n> A few questions:\n>   - is there a way to say \"push all tags matching /COREUTILS-*/\"\n>       or to say \"push all tags, except the ones on this list\"?\n\n\nHere's a snippet from the default update hook we use on all our repos. \nWe explicitly deny any non-annotated tags from being pushed to the \ncentral server and let rogue devs know why the push failed by writing \nthe error message to stderr so that it gets sent over the wire. I \nbelieve this is still the default update-hook shipped with git.\n---%<---%<----%<---\nref_type=$(git cat-file -t \"$3\")\n\n# Only allow annotated tags in a shared repo\n# Remove this code to treat dumb tags the same as everything else\ncase \"$1\",\"$ref_type\" in\nrefs/tags/*,commit)\n     echo \"*** Un-annotated tags are not allowed in this repo\" >&2\n     echo \"*** Use 'git tag [ -a | -s ]' for tags you want to \npropagate.\" >&2\n     exit 1;;\n---%<---%<---%<---\n\n>   - is there a way to remove the cvs-head tag from the remote directory?\n>       Note: I don't have shell access there.  I can request that someone\n>       with shell access do it, but shouldn't have to resort to that.\n>   - is there some way to make \"git push\" do what I want, and update the\n>       offending tag in the remote repo?\n> \n\nI'm not sure if execution reaches the update hook when you're uploading \na tag that already exists. If it is, you could simply remove the \noffending tag in the update-hook and exit 0 to make it work properly. \nYou can test this without shell-access on the remote system by setting \nup a repo on your local machine, making some dummy commit, cloning it \nand then hacking away on the hook while pushing to it from your local repo.\n\nOther than that, push your tags manually by naming them explicitly on \nthe push-line, like so:\n$ git push $remote_repo $tag_name\n\nThis is what I do whenever we cut a release. With a one tag per release, \nit's not very troublesome at all, and the update-hook sends a nicely \nformatted message of the changes since the last release (last tag \nreally, but it amounts to the same thing for us) to everyone involved.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\n"},{"id":"298168","messageId":"7virgz1bz7.fsf@assigned-by-dhcp.cox.net","threadId":"43514","inReplyTo":"87wt5rffbm.fsf@rho.meyering.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-28T21:46:04Z","receivedAt":"2006-11-28T21:46:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jim Meyering <jim@meyering.net> writes:\n\n> Here's the problem:\n> When I try to push the new tags, git-push fails:\n>\n>   $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master\n>   updating 'refs/tags/cvs-head'\n>     from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100\n>     to   db18f53ffb221e9957124d8af81c11a7e350ac3b\n>   ...\n>   Total 1, written 1 (delta 0), reused 0 (delta 0)\n>   Unpacking 1 objects\n>   error: denying non-fast forward; you should pull first\n>\n> I get the same error also when using --force.\n\nI think this is due to overeager receive.denyNonFastForwards\nconfiguration setting at the repository you are pushing into.\n\nI _think_ what receive-pack does in this case is totally wrong.\nIt should either:\n\n (1) deny overwriting existing tags -- tags are meant to be\n     immutable so it should not allow them to be \"updated\"\n     regardless of fast-forwardness, or\n\n (2) allow overwriting things under refs/tags/ without any\n     fast-forward checking.  After all, a tag could point at a\n     tree or a blob, and there is no fast-forwardness among\n     trees.\n\nThe client side check in \"git fetch\" takes the latter viewpoint,\nand I think we should be consistent with it.\n\nJohannes, what do you think?  Does the following patch look sane\nto you?\n\n---\n\ndiff --git a/receive-pack.c b/receive-pack.c\nindex 1a141dc..6c3de47 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -120,7 +120,7 @@ static int update(struct command *cmd)\n \t\t\t     \"but I can't find it!\", new_hex);\n \t}\n \tif (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&\n-\t    !is_null_sha1(old_sha1)) {\n+\t    !is_null_sha1(old_sha1) && !strncmp(name, \"refs/heads/\", 11)) {\n \t\tstruct commit *old_commit, *new_commit;\n \t\tstruct commit_list *bases, *ent;\n \n"},{"id":"297597","messageId":"Pine.LNX.4.63.0611291040590.30004@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43514","inReplyTo":"7virgz1bz7.fsf@assigned-by-dhcp.cox.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-11-29T09:54:10Z","receivedAt":"2006-11-29T09:54:10Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 28 Nov 2006, Junio C Hamano wrote:\n\n> Jim Meyering <jim@meyering.net> writes:\n> \n> > Here's the problem:\n> > When I try to push the new tags, git-push fails:\n> >\n> >   $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master\n> >   updating 'refs/tags/cvs-head'\n> >     from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100\n> >     to   db18f53ffb221e9957124d8af81c11a7e350ac3b\n> >   ...\n> >   Total 1, written 1 (delta 0), reused 0 (delta 0)\n> >   Unpacking 1 objects\n> >   error: denying non-fast forward; you should pull first\n> >\n> > I get the same error also when using --force.\n> \n> I think this is due to overeager receive.denyNonFastForwards\n> configuration setting at the repository you are pushing into.\n> \n> I _think_ what receive-pack does in this case is totally wrong.\n> It should either:\n> \n>  (1) deny overwriting existing tags -- tags are meant to be\n>      immutable so it should not allow them to be \"updated\"\n>      regardless of fast-forwardness, or\n> \n>  (2) allow overwriting things under refs/tags/ without any\n>      fast-forward checking.  After all, a tag could point at a\n>      tree or a blob, and there is no fast-forwardness among\n>      trees.\n> \n> The client side check in \"git fetch\" takes the latter viewpoint,\n> and I think we should be consistent with it.\n> \n> Johannes, what do you think?  Does the following patch look sane\n> to you?\n\nIt does if you agree that (2) is correct.\n\nBut I don't agree. cvs-head really should be a head IMHO, not a tag, \nbecause cvs-head really tracks a branch.\n\nI also think that git-fetch silently updating tags is wrong. Rather, it \nshould warn that the tags are different. But I've been wrong before.\n\nCiao,\nDscho\n"},{"id":"297488","messageId":"87u00imsin.fsf@rho.meyering.net","threadId":"43514","inReplyTo":"Pine.LNX.4.63.0611291040590.30004@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2006-11-29T10:55:28Z","receivedAt":"2006-11-29T10:55:28Z","isPatch":false,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Tue, 28 Nov 2006, Junio C Hamano wrote:\n...\n>> I think this is due to overeager receive.denyNonFastForwards\n>> configuration setting at the repository you are pushing into.\n\nJunio, thank you for following up on this!\n\n>> I _think_ what receive-pack does in this case is totally wrong.\n>> It should either:\n>>\n>>  (1) deny overwriting existing tags -- tags are meant to be\n>>      immutable so it should not allow them to be \"updated\"\n>>      regardless of fast-forwardness, or\n>>\n>>  (2) allow overwriting things under refs/tags/ without any\n>>      fast-forward checking.  After all, a tag could point at a\n>>      tree or a blob, and there is no fast-forwardness among\n>>      trees.\n>>\n>> The client side check in \"git fetch\" takes the latter viewpoint,\n>> and I think we should be consistent with it.\n\n>> Johannes, what do you think?  Does the following patch look sane\n>> to you?\n>\n> It does if you agree that (2) is correct.\n>\n> But I don't agree. cvs-head really should be a head IMHO, not a tag,\n> because cvs-head really tracks a branch.\n>\n> I also think that git-fetch silently updating tags is wrong. Rather, it\n> should warn that the tags are different. But I've been wrong before.\n\nAFAIK, no one wants git-fetch to update tags _silently_.\nI expected it give a diagnostic and fail by default -- and it already\ndoes that.  Pushing moved tags is serious business.  I was hoping to be\nable to use --force to override that fail-safe.\n\nMy goal is to maintain a symbolic reference \"cvs-head\" that points\nto the newest git trunk node that's been mirrored to a CVS repository.\nWithout even considering any other option, I chose to use a lightweight\ntag for that purpose, since I have a conceptual view that it's a label I\ncan move from one referent to another.  It strikes me as counter-intuitive\nto use a temporary git \"branch\" that way.  Would that even work, removing\nit and recreating it all the time?  Hmm.. or maybe you mean to create the\nbranch once and then to merge from the trunk repeatedly.  That seems\nlike unnecessary work, when all I want is a movable label.\n\nI admit that I like the idea of release tags being immutable, but even\nthere, it's happened that I've made-but-not-published a release, then\nrealized that it wasn't quite complete.  I was glad to be able to go\nback and re-tag after making corrections.\n\nI wouldn't mind having a way to specify that a pushed tag is *not*\n"},{"id":"297092","messageId":"Pine.LNX.4.63.0611291220130.30004@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43514","inReplyTo":"87u00imsin.fsf@rho.meyering.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-11-29T11:45:36Z","receivedAt":"2006-11-29T11:45:36Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 29 Nov 2006, Jim Meyering wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> > I also think that git-fetch silently updating tags is wrong. Rather, it\n> > should warn that the tags are different. But I've been wrong before.\n> \n> AFAIK, no one wants git-fetch to update tags _silently_. I expected it \n> give a diagnostic and fail by default -- and it already does that.\n\nUmm. I just tested it, and it said \"updating tag\" without failing.\n\n> Pushing moved tags is serious business.  I was hoping to be able to use \n> --force to override that fail-safe.\n\nHmmm. Probably Junio's patch is correct after all, since tags are special \ncreatures: you do not expect them to change, but if, they can change \narbitrarily (as opposed to branches, which should evolve linearly).\n\n> My goal is to maintain a symbolic reference \"cvs-head\" that points\n> to the newest git trunk node that's been mirrored to a CVS repository.\n\nBut is that not just tracking another branch?\n\n> Without even considering any other option, I chose to use a lightweight\n> tag for that purpose, since I have a conceptual view that it's a label I\n> can move from one referent to another.  It strikes me as counter-intuitive\n> to use a temporary git \"branch\" that way.  Would that even work, removing\n> it and recreating it all the time?\n\nYes, it would. Remember: a branch in git is just a named ref. It \nliterally used to be a 41-byte file pointing to the tip of the branch in \nthe ancestor graph. And you can update it with git-update-ref.\n\nSo, a branch in git is very much the movable label you are looking for.\n\nCiao,\nDscho\n"},{"id":"298085","messageId":"456D736B.3040707@shadowen.org","threadId":"43514","inReplyTo":"87u00imsin.fsf@rho.meyering.net","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-11-29T11:47:55Z","receivedAt":"2006-11-29T11:47:55Z","isPatch":false,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Jim Meyering wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>> On Tue, 28 Nov 2006, Junio C Hamano wrote:\n> ...\n>>> I think this is due to overeager receive.denyNonFastForwards\n>>> configuration setting at the repository you are pushing into.\n> \n> Junio, thank you for following up on this!\n> \n>>> I _think_ what receive-pack does in this case is totally wrong.\n>>> It should either:\n>>>\n>>>  (1) deny overwriting existing tags -- tags are meant to be\n>>>      immutable so it should not allow them to be \"updated\"\n>>>      regardless of fast-forwardness, or\n>>>\n>>>  (2) allow overwriting things under refs/tags/ without any\n>>>      fast-forward checking.  After all, a tag could point at a\n>>>      tree or a blob, and there is no fast-forwardness among\n>>>      trees.\n>>>\n>>> The client side check in \"git fetch\" takes the latter viewpoint,\n>>> and I think we should be consistent with it.\n> \n>>> Johannes, what do you think?  Does the following patch look sane\n>>> to you?\n>> It does if you agree that (2) is correct.\n>>\n>> But I don't agree. cvs-head really should be a head IMHO, not a tag,\n>> because cvs-head really tracks a branch.\n>>\n>> I also think that git-fetch silently updating tags is wrong. Rather, it\n>> should warn that the tags are different. But I've been wrong before.\n> \n> AFAIK, no one wants git-fetch to update tags _silently_.\n> I expected it give a diagnostic and fail by default -- and it already\n> does that.  Pushing moved tags is serious business.  I was hoping to be\n> able to use --force to override that fail-safe.\n> \n> My goal is to maintain a symbolic reference \"cvs-head\" that points\n> to the newest git trunk node that's been mirrored to a CVS repository.\n> Without even considering any other option, I chose to use a lightweight\n> tag for that purpose, since I have a conceptual view that it's a label I\n> can move from one referent to another.  It strikes me as counter-intuitive\n> to use a temporary git \"branch\" that way.  Would that even work, removing\n> it and recreating it all the time?  Hmm.. or maybe you mean to create the\n> branch once and then to merge from the trunk repeatedly.  That seems\n> like unnecessary work, when all I want is a movable label.\n\nWell remember that all heads are simply references into the DAG, they\nare all labels.  'heads' you are allowed to move and change, commit to\netc, but they are still just name -> sha1 mechanisms.\n\nIf the merge is a ff then there is no work.  You could always use\n'reset' instead to move the branch to the right place in the DAG.\n\n> \n> I admit that I like the idea of release tags being immutable, but even\n> there, it's happened that I've made-but-not-published a release, then\n> realized that it wasn't quite complete.  I was glad to be able to go\n> back and re-tag after making corrections.\n> \n> I wouldn't mind having a way to specify that a pushed tag is *not*\n> immutable, with the default being it is immutable.\n\n"},{"id":"297454","messageId":"ekk2sh$8ja$1@sea.gmane.org","threadId":"43514","inReplyTo":"Pine.LNX.4.63.0611291220130.30004@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: can I remove or move a tag in a remote repository?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-29T13:46:40Z","receivedAt":"2006-11-29T13:46:40Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrote:\n\n>> Without even considering any other option, I chose to use a lightweight\n>> tag for that purpose, since I have a conceptual view that it's a label I\n>> can move from one referent to another.  It strikes me as counter-intuitive\n>> to use a temporary git \"branch\" that way.  Would that even work, removing\n>> it and recreating it all the time?\n> \n> Yes, it would. Remember: a branch in git is just a named ref. It \n> literally used to be a 41-byte file pointing to the tip of the branch in \n> the ancestor graph. And you can update it with git-update-ref.\n> \n> So, a branch in git is very much the movable label you are looking for.\n\nAnd even if cvs-head does not fast-forward, remember that pu branch also\ndoesn't fast-forward (usually).\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"}]}