{"thread":{"id":"13291","subject":"[updated PATCH] Protect current tags, import tags into remote tree","startedAt":"2008-04-27T17:32:46Z","lastAt":"2008-04-29T06:18:33Z","messageCount":4,"participants":["Stephen R. van den Berg","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"75308","messageId":"20080427173246.10023.94820.stgit@aristoteles.cuci.nl","threadId":"13291","inReplyTo":null,"subject":"[updated PATCH] Protect current tags, import tags into remote tree","fromName":"Stephen R. van den Berg","fromEmail":"srb@cuci.nl","sentAt":"2008-04-27T17:32:46Z","receivedAt":"2008-04-27T17:32:46Z","isPatch":true,"sender":{"key":"srb@cuci.nl","avatar":"https://gravatar.com/avatar/f75389059e827634d38e9df2a9b6ecbd50028b5a454442efa1c7205b7ff29c6a?d=mp&s=160"},"body":"git-cvsimport properly creates a subdir in refs/remotes to put the\nbranches in from the remote repository, it currently stores any tags\ndirectly in refs/tags, which makes the imported tags overwrite current\nones.  This patch makes sure that imported tags are under the proper\nrefs/remotes/.../tags subdirectory as well.\n\nSigned-off-by: Stephen R. van den Berg <srb@cuci.nl>\n---\n\n git-cvsimport.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 95c5eec..73109d6 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -781,7 +781,7 @@ sub commit {\n \t\t$xtag =~ tr/_/\\./ if ( $opt_u );\n \t\t$xtag =~ s/[\\/]/$opt_s/g;\n \n-\t\tsystem('git-tag', '-f', $xtag, $cid) == 0\n+\t\tsystem(\"git-update-ref $remote/tags/$xtag $cid\") == 0\n \t\t\tor die \"Cannot create tag $xtag: $!\\n\";\n \n \t\tprint \"Created tag '$xtag' on '$branch'\\n\" if $opt_v;\n"},{"id":"75394","messageId":"7vmynec60v.fsf@gitster.siamese.dyndns.org","threadId":"13291","inReplyTo":"20080427173246.10023.94820.stgit@aristoteles.cuci.nl","subject":"Re: [updated PATCH] Protect current tags, import tags into remote tree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-28T16:12:48Z","receivedAt":"2008-04-28T16:12:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Stephen R. van den Berg\" <srb@cuci.nl> writes:\n\n> ..., it currently stores any tags\n> directly in refs/tags,...\n\nwhich is consistent with the way all the native Porcelain commands handle\ntags.  There is no per-remote namespace for tags in git Porcelain.\n\nFor some people, the patch would be an improvement, but for some other\npeople, this would be a regression.\n\nIt needs discussion and concensus if we were to do this; currently I am\nnot very much in favor of this change.\n"},{"id":"75425","messageId":"20080428184859.GA21950@cuci.nl","threadId":"13291","inReplyTo":"7vmynec60v.fsf@gitster.siamese.dyndns.org","subject":"Re: [updated PATCH] Protect current tags, import tags into remote tree","fromName":"Stephen R. van den Berg","fromEmail":"srb@cuci.nl","sentAt":"2008-04-28T18:48:59Z","receivedAt":"2008-04-28T18:48:59Z","isPatch":true,"sender":{"key":"srb@cuci.nl","avatar":"https://gravatar.com/avatar/f75389059e827634d38e9df2a9b6ecbd50028b5a454442efa1c7205b7ff29c6a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n>\"Stephen R. van den Berg\" <srb@cuci.nl> writes:\n\n>> ..., it currently stores any tags\n>> directly in refs/tags,...\n\n>which is consistent with the way all the native Porcelain commands handle\n>tags.  There is no per-remote namespace for tags in git Porcelain.\n\nThere is in git-svn.\n\n>For some people, the patch would be an improvement, but for some other\n>people, this would be a regression.\n\nDue to the quirks of CVS (and SVN), over time many CVS/SVN repositories\nhave picked up a lot of tags which either made sense at the time (but\ndon't anymore), or have not been wiped because of the\ndifficulty/impossibility to do so in the old repository.\n\nThe usual way to import from CVS is to do the import, then pick the\nbranches and tags you really want to keep, copy/replicate them outside\nremotes and then move on in a clean fashion.\n\nRerunning cvsimport on a regular basis causes the import to (re)create\nall the tags from CVS again; if this is done in your regular tags space,\nthis is a mess at best, or overwrites whatever renamed tags you\ncarefully created which happen to match with old CVS tagnames.\n\ngit-svn *does* use the tags namespace under remotes, so it does it the\n'proper' way.\nWith respect to the concern that all git porcelain works without a\nseparate remotes/.../tags namespace, two things:\n- git-svn and git-cvsimport cross the boundary to a different VCS and\n  therefore can/should use an extra barrier before (auto)converting to\n  git native tags (and branches).\n- I personally would find it most natural when upon cloning a git\n  repository not only the branches cloned end up in a separate remotes\n  namespace (like they do now already), but that the tags would do the same\n  (e.g. in remotes/.../tags).\n\nEven if this behaviour is not deemed \"good\" to be a new default, I'd\nstrongly suggest to at least make it optional using an appropriate flag\n(and respective git-config variable to make it the local default).\n-- \nSincerely,                                                          srb@cuci.nl\n           Stephen R. van den Berg.\n\"It is better for civilization to be going down the drain than\n to be coming up it.\"\n"},{"id":"75495","messageId":"7vbq3t89qe.fsf@gitster.siamese.dyndns.org","threadId":"13291","inReplyTo":"20080428184859.GA21950@cuci.nl","subject":"Re: [updated PATCH] Protect current tags, import tags into remote tree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-29T06:18:33Z","receivedAt":"2008-04-29T06:18:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Stephen R. van den Berg\" <srb@cuci.nl> writes:\n\n> Rerunning cvsimport on a regular basis causes the import to (re)create\n> all the tags from CVS again; if this is done in your regular tags space,\n> this is a mess at best, or overwrites whatever renamed tags you\n> carefully created which happen to match with old CVS tagnames.\n> ...\n> - git-svn and git-cvsimport cross the boundary to a different VCS and\n>   therefore can/should use an extra barrier before (auto)converting to\n>   git native tags (and branches).\n\nThat sounds like a sound argument, and perhaps people may wish we did so\nfrom the day one.  Alas, we didn't.\n\nSo the course of action would be to do these over a long period of time.\n\n - introduce this as an option now;\n\n - give another option to explicitly ask for the current behaviour;\n\n - perhaps give an advance warning that this optional behaviour will\n   become the default; and\n\n - finally swap the default behaviour.\n\nif people agree with this change, that is.\n"}]}