{"thread":{"id":"21926","subject":"FEATURE REQUEST: display <commit SHA> in message: git tag -d","startedAt":"2009-12-10T10:06:56Z","lastAt":"2009-12-10T14:16:18Z","messageCount":10,"participants":["Jari Aalto","Michael J Gruber","Björn Steinbrink","Jeff King","Zoltán Füzesi"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129679","messageId":"87ljhb87nj.fsf@jondo.cante.net","threadId":"21926","inReplyTo":null,"subject":"FEATURE REQUEST: display <commit SHA> in message: git tag -d","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2009-12-10T10:06:56Z","receivedAt":"2009-12-10T10:06:56Z","isPatch":false,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"\nIt would be helpful if the delete command would displayed the SHA:\n\n    $ git tag -d foo/20060213-1\n    Deleted tag 'foo/20060213-1'\n\n    ...  oops, I didn't want to do that\n    ...  Whatwas the commit ID again that I can restore the tag?\n\nInstead:\n\n    $ git tag -d foo/20060213-1\n    Deleted tag 'foo/20060213-1' 4b397f6\n\n    ...  oops, I didn't want to do that\n\n    $ git tag 'foo/20060213-1' 4b397f6\n\n    ... retagged, phew.\n\nNotice that the message is in the format of copy/paste for immediate\nretagging.\n\nJari\n"},{"id":"129682","messageId":"3b0a7bfa75126e4c13ec15a4357645b2bfd14b5b.1260447713.git.git@drmicha.warpmail.net","threadId":"21926","inReplyTo":"87ljhb87nj.fsf@jondo.cante.net","subject":"[PATCH] tag -d: print sha1 of deleted tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-10T12:23:43Z","receivedAt":"2009-12-10T12:23:43Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Print the sha1 of the deleted tag (in addition to the tag name) so that\none can easily recreate a mistakenly deleted tag:\n\ngit tag -d tagname\nDeleted tag 'tagname' DEADBEEF\ngit tag 'tagname' DEADBEEF # for lightweight tags\ngit update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\nSuggested-by: Jari Aalto <jari.aalto@cante.net>\n---\n builtin-tag.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-tag.c b/builtin-tag.c\nindex c479018..39d0ce2 100644\n--- a/builtin-tag.c\n+++ b/builtin-tag.c\n@@ -140,7 +140,7 @@ static int delete_tag(const char *name, const char *ref,\n {\n \tif (delete_ref(ref, sha1, 0))\n \t\treturn 1;\n-\tprintf(\"Deleted tag '%s'\\n\", name);\n+\tprintf(\"Deleted tag '%s' %s\\n\", name, sha1_to_hex(sha1));\n \treturn 0;\n }\n \n-- \n1.6.6.rc1.292.gd8fe\n"},{"id":"129684","messageId":"20091210124701.GA12521@atjola.homenet","threadId":"21926","inReplyTo":"3b0a7bfa75126e4c13ec15a4357645b2bfd14b5b.1260447713.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-12-10T12:47:01Z","receivedAt":"2009-12-10T12:47:01Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.12.10 13:23:43 +0100, Michael J Gruber wrote:\n> Print the sha1 of the deleted tag (in addition to the tag name) so that\n> one can easily recreate a mistakenly deleted tag:\n> \n> git tag -d tagname\n> Deleted tag 'tagname' DEADBEEF\n> git tag 'tagname' DEADBEEF # for lightweight tags\n> git update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n\nUsing \"git tag 'tagname' DEADBEEF\" should actually work in both cases.\nAs that does nothing but creating the ref in the refs/tags/ namespace.\n\nBjoern\n"},{"id":"129685","messageId":"20091210124929.GA444@coredump.intra.peff.net","threadId":"21926","inReplyTo":"3b0a7bfa75126e4c13ec15a4357645b2bfd14b5b.1260447713.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-10T12:49:29Z","receivedAt":"2009-12-10T12:49:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Dec 10, 2009 at 01:23:43PM +0100, Michael J Gruber wrote:\n\n> Print the sha1 of the deleted tag (in addition to the tag name) so that\n> one can easily recreate a mistakenly deleted tag:\n> \n> git tag -d tagname\n> Deleted tag 'tagname' DEADBEEF\n> git tag 'tagname' DEADBEEF # for lightweight tags\n> git update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n\nI think this is a good idea, and we already do the same for branch\ndeletion.\n\nI'm not sure your example is right. If \"tag -d\" always prints out the\nsha1 in the tag ref, can't you just use \"git tag 'tagname' DEADBEEF\" to\nrecreate both lightweight and annotated tags? That is, making a\nlightweight tag of an annotated tag's sha1 should just recreate the\noriginal annotated tag.\n\nThat being said, I am not a fan of the cut-and-paste format. This is not\nsomething that happens so frequently that I think we need to go out of\nour way to save some typing. And for a user seeing this message for the\nfirst time:\n\n  1. It is not immediately obvious to a user seeing this message\n     for this first time exactly what the trailing sha1 means. We\n     already had this discussion with \"git branch -d\" and decided\n     that \"(was DEADBEEF)\" was more readable.\n\n  2. Even if they know what it means, it is not immediately obvious that\n     the error line is meant to be cut-and-pasted. If you are going to\n     give something to cut-and-paste, I think you are better off making\n     it obvious, like:\n\n        Deleted tag 'foo'; you can recreate it with\n\n           git tag 'foo' DEADBEEF\n\n     Of course that is painfully long for a message that is meant to be\n     a \"just in case\" notification of a successful command (I can see it\n     more for an actual error, where git is telling you \"I couldn't do\n     what you wanted, but you might try running this command first\").\n\n-Peff\n"},{"id":"129686","messageId":"87hbrz6kbs.fsf@jondo.cante.net","threadId":"21926","inReplyTo":"20091210124929.GA444@coredump.intra.peff.net","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Jari Aalto","fromEmail":"jari.aalto@cante.net","sentAt":"2009-12-10T13:16:07Z","receivedAt":"2009-12-10T13:16:07Z","isPatch":true,"sender":{"key":"jari.aalto@cante.net","avatar":"https://avatars.githubusercontent.com/u/34601?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Dec 10, 2009 at 01:23:43PM +0100, Michael J Gruber wrote:\n>\n>> Print the sha1 of the deleted tag (in addition to the tag name) so that\n>> one can easily recreate a mistakenly deleted tag:\n>> \n>> git tag -d tagname\n>> Deleted tag 'tagname' DEADBEEF\n>> git tag 'tagname' DEADBEEF # for lightweight tags\n>> git update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n\n> That being said, I am not a fan of the cut-and-paste format. This is not\n> something that happens so frequently\n\nIt dpends on user. For me it it does.\n\n>   1. It is not immediately obvious to a user seeing this message\n>      for this first time exactly what the trailing sha1 means.\n>\n>   2. Even if they know what it means, it is not immediately obvious that\n>      the error line is meant to be cut-and-pasted.\n\n\"not meant\" specifically, but it's very convenient to have it in format\nthat happens to be \"cut-n-paste ready\". The SHA itself is easily\nunderstood in the context.\n\nThanks for all that have so quickly implemented this,\nJari\n"},{"id":"129687","messageId":"4B20F5E3.20004@drmicha.warpmail.net","threadId":"21926","inReplyTo":"20091210124701.GA12521@atjola.homenet","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-10T13:21:39Z","receivedAt":"2009-12-10T13:21:39Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Björn Steinbrink venit, vidit, dixit 10.12.2009 13:47:\n> On 2009.12.10 13:23:43 +0100, Michael J Gruber wrote:\n>> Print the sha1 of the deleted tag (in addition to the tag name) so that\n>> one can easily recreate a mistakenly deleted tag:\n>>\n>> git tag -d tagname\n>> Deleted tag 'tagname' DEADBEEF\n>> git tag 'tagname' DEADBEEF # for lightweight tags\n>> git update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n> \n> Using \"git tag 'tagname' DEADBEEF\" should actually work in both cases.\n> As that does nothing but creating the ref in the refs/tags/ namespace.\n> \n> Bjoern\n\nCool, even better! So, an annotated tag is practically a lightweight tag\npointing to a tag object. Once you think of it it's natural!\n\nMichael\n"},{"id":"129689","messageId":"4B20F733.6010401@drmicha.warpmail.net","threadId":"21926","inReplyTo":"20091210124929.GA444@coredump.intra.peff.net","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-10T13:27:15Z","receivedAt":"2009-12-10T13:27:15Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jeff King venit, vidit, dixit 10.12.2009 13:49:\n> On Thu, Dec 10, 2009 at 01:23:43PM +0100, Michael J Gruber wrote:\n> \n>> Print the sha1 of the deleted tag (in addition to the tag name) so that\n>> one can easily recreate a mistakenly deleted tag:\n>>\n>> git tag -d tagname\n>> Deleted tag 'tagname' DEADBEEF\n>> git tag 'tagname' DEADBEEF # for lightweight tags\n>> git update-ref refs/tags/'tagname' DEADBEEF # for annotated tags\n> \n> I think this is a good idea, and we already do the same for branch\n> deletion.\n> \n> I'm not sure your example is right. If \"tag -d\" always prints out the\n> sha1 in the tag ref, can't you just use \"git tag 'tagname' DEADBEEF\" to\n> recreate both lightweight and annotated tags? That is, making a\n> lightweight tag of an annotated tag's sha1 should just recreate the\n> original annotated tag.\n\nWhile my example is right it is unnecessarily complex. I learned that\nthrough Björns and your remark.\n\n> That being said, I am not a fan of the cut-and-paste format. This is not\n> something that happens so frequently that I think we need to go out of\n> our way to save some typing. And for a user seeing this message for the\n> first time:\n> \n>   1. It is not immediately obvious to a user seeing this message\n>      for this first time exactly what the trailing sha1 means. We\n>      already had this discussion with \"git branch -d\" and decided\n>      that \"(was DEADBEEF)\" was more readable.\n\nSo, should we simply go with that then?\n\nMeanwhile, RFCs/PATCHes crossed paths. I take it that Zoltan suggests\ngiving the same output for force-overwritten existing tags. I beat him\nby 11 minutes, though ;)\n\nMichael\n"},{"id":"129690","messageId":"20091210133645.GA2149@coredump.intra.peff.net","threadId":"21926","inReplyTo":"4B20F733.6010401@drmicha.warpmail.net","subject":"Re: [PATCH] tag -d: print sha1 of deleted tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-10T13:36:46Z","receivedAt":"2009-12-10T13:36:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Dec 10, 2009 at 02:27:15PM +0100, Michael J Gruber wrote:\n\n> >   1. It is not immediately obvious to a user seeing this message\n> >      for this first time exactly what the trailing sha1 means. We\n> >      already had this discussion with \"git branch -d\" and decided\n> >      that \"(was DEADBEEF)\" was more readable.\n> \n> So, should we simply go with that then?\n\nI think so. Jari obviously disagrees, but I don't have much more to say\nin favor of it except that I find the other ugly and unintuitive. So it\nis up to you what you want to submit and Junio what he wants to apply.\n:)\n\n> Meanwhile, RFCs/PATCHes crossed paths. I take it that Zoltan suggests\n> giving the same output for force-overwritten existing tags. I beat him\n> by 11 minutes, though ;)\n\nYes, I think if you are going to protect \"tag -d\", you might as well\nprotect overwriting, as well.  Which made me think at first that we need\nsomething similar for \"branch -f\", but I don't think we do; the last\nbranch value will be left in the reflog (but with tags, there is no\nreflog).\n\n-Peff\n"},{"id":"129692","messageId":"39e5cb38658919ed989f954a0917dfaa292f6350.1260453234.git.git@drmicha.warpmail.net","threadId":"21926","inReplyTo":"20091210133645.GA2149@coredump.intra.peff.net","subject":"[PATCH v2] tag -d: print sha1 of deleted tag","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-10T14:01:10Z","receivedAt":"2009-12-10T14:01:10Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Print the sha1 of the deleted tag (in addition to the tag name) so that\none can easily recreate a mistakenly deleted tag:\n\ngit tag -d tagname\nDeleted tag 'tagname' (was DEADBEEF)\ngit tag 'tagname' DEADBEEF\n\nWe output the previous ref also in the case of forcefully overwriting\ntags.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\nSuggested-by: Jari Aalto <jari.aalto@cante.net>\nHelped-by: Björn Steinbrink <B.Steinbrink@gmx.de>\nHelped-by: Jeff King <peff@peff.net>\nHelped-by: Zoltán Füzesi <zfuzesi@eaglet.hu>\n---\nv2 changes the wording to match with branch -d and uses the same\nfor forcefully overwriting tags.\n\nZoltán, I don't think we should make this into a race. Posting in\nthe relevant thread (and actually following it) would help this.\n\nAlso, I think we should really compare the sha1 the tag points to,\ni.e. like below and like in your v1 (not v2). Different tag object\nis different tag (message may differ, e.g.).\n\n builtin-tag.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-tag.c b/builtin-tag.c\nindex c479018..4ef1c4f 100644\n--- a/builtin-tag.c\n+++ b/builtin-tag.c\n@@ -140,7 +140,7 @@ static int delete_tag(const char *name, const char *ref,\n {\n \tif (delete_ref(ref, sha1, 0))\n \t\treturn 1;\n-\tprintf(\"Deleted tag '%s'\\n\", name);\n+\tprintf(\"Deleted tag '%s' (was %s)\\n\", name, find_unique_abbrev(sha1, DEFAULT_ABBREV));\n \treturn 0;\n }\n \n@@ -479,6 +479,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \t\tdie(\"%s: cannot lock the ref\", ref);\n \tif (write_ref_sha1(lock, object, NULL) < 0)\n \t\tdie(\"%s: cannot update the ref\", ref);\n+\tif (force && hashcmp(prev, object))\n+\t\tprintf(\"Updated tag '%s' (was %s)\\n\", tag, find_unique_abbrev(prev, DEFAULT_ABBREV));\n \n \tstrbuf_release(&buf);\n \treturn 0;\n-- \n1.6.6.rc1.292.gd8fe\n"},{"id":"129695","messageId":"9ab80d150912100616u58391fe3k1f1e921b23417abc@mail.gmail.com","threadId":"21926","inReplyTo":"39e5cb38658919ed989f954a0917dfaa292f6350.1260453234.git.git@drmicha.warpmail.net","subject":"Re: [PATCH v2] tag -d: print sha1 of deleted tag","fromName":"Zoltán Füzesi","fromEmail":"zfuzesi@eaglet.hu","sentAt":"2009-12-10T14:16:18Z","receivedAt":"2009-12-10T14:16:18Z","isPatch":true,"sender":{"key":"zfuzesi@eaglet.hu","avatar":null},"body":"2009/12/10 Michael J Gruber <git@drmicha.warpmail.net>:\n> Zoltán, I don't think we should make this into a race. Posting in\n> the relevant thread (and actually following it) would help this.\n\nYou are right. I've deleted the feature request mail, and then few\nminutes laster decided to create the patch. So I've lost the message\nID (though I could retrieve it from the web...).\nAfter posting the patch, noticed that you also posted one.\n\n> Also, I think we should really compare the sha1 the tag points to,\n> i.e. like below and like in your v1 (not v2). Different tag object\n> is different tag (message may differ, e.g.).\n\nI agree.\n"}]}