{"thread":{"id":"10084","subject":"Script to backdate tags","startedAt":"2007-09-30T03:16:32Z","lastAt":"2007-10-15T22:53:43Z","messageCount":7,"participants":["Michael Olson","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54389","messageId":"87bqbklu5r.fsf@hariken.mwolson.org","threadId":"10084","inReplyTo":null,"subject":"Script to backdate tags","fromName":"Michael Olson","fromEmail":"mwolson@gnu.org","sentAt":"2007-09-30T03:16:32Z","receivedAt":"2007-09-30T03:16:32Z","isPatch":false,"sender":{"key":"mwolson@gnu.org","avatar":"https://avatars.githubusercontent.com/u/1510193?v=4"},"body":"After importing one of my projects from Arch, I wanted to add tags that\nindicated its major releases.  Unfortunately, these tags for older\nreleases would show up before the more recent releases in the gitweb\noutput.  I searched in vain for a way of backdating tags, and finally\ndecided to make a script to do this for me.  Here it is.\n\nThis may run into issues if someone uses the \"\\\" character in their tag\nnames, but I didn't want to bother fixing this until it was affirmed\nthat this script would be considered generally useful.\n\n\n\n#!/bin/sh\n#\n# git-backdate-tag: Change the date of an existing tag, replacing the\n# tag reference with the newly-generated tag object.\n#\n# Usage: git-backdate-tag TAG DATE\n\nusage () {\n    echo \"Usage: git-backdate-tag TAG DATE\"\n}\n\nif [ -n \"$3\" ]; then\n    usage\n    exit 1\nelif [ -z \"$2\" ]; then\n    usage\n    exit 1\nfi\n\n# Set parameters\ntag=\"$1\"\ndate=$(date --date=\"$2\" +%s)\n\nif [ $? -ne 0 ]; then\n    echo Could not parse date\n    exit 1\nfi\n\n# Replace old date with new date\nnewtagobj=$(git cat-file tag \"$tag\" | \\\n    sed -r -e \"s/^(tagger .+) ([^ \\\\n]+) ([^ \\\\n]+)\\$/\\1 $date \\3/1\" | \\\n    git mktag)\n\nif [ $? -ne 0 ]; then\n    echo Could not create replacement tag object\n    exit 1\nfi\n\n# Set tag to new tag object\ngit update-ref refs/tags/\"$tag\" $newtagobj\n\n\n\n-- \n       Michael Olson -- FSF Associate Member #652     |\n http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\\ | | |\n            Sysadmin -- Hobbies: Lisp, GP2X, HCoop    | |_] | \\| |_|\nProjects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |\n"},{"id":"54391","messageId":"871wcglqrg.fsf@hariken.mwolson.org","threadId":"10084","inReplyTo":"87bqbklu5r.fsf@hariken.mwolson.org","subject":"Re: Script to backdate tags","fromName":"Michael Olson","fromEmail":"mwolson@gnu.org","sentAt":"2007-09-30T04:29:55Z","receivedAt":"2007-09-30T04:29:55Z","isPatch":false,"sender":{"key":"mwolson@gnu.org","avatar":"https://avatars.githubusercontent.com/u/1510193?v=4"},"body":"Michael Olson <mwolson@gnu.org> writes:\n\n> This may run into issues if someone uses the \"\\\" character in their\n> tag names, [snip].\n\nIn fact, this isn't the case after all.\n\n-- \n       Michael Olson -- FSF Associate Member #652     |\n http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\\ | | |\n            Sysadmin -- Hobbies: Lisp, GP2X, HCoop    | |_] | \\| |_|\nProjects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |\n"},{"id":"54392","messageId":"7vps00ivgh.fsf@gitster.siamese.dyndns.org","threadId":"10084","inReplyTo":"871wcglqrg.fsf@hariken.mwolson.org","subject":"Re: Script to backdate tags","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-30T05:16:46Z","receivedAt":"2007-09-30T05:16:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Olson <mwolson@gnu.org> writes:\n\n> Michael Olson <mwolson@gnu.org> writes:\n>\n>> This may run into issues if someone uses the \"\\\" character in their\n>> tag names, [snip].\n>\n> In fact, this isn't the case after all.\n\nWouldn't it be easier to create the tag with the desired\ntimestamp from the beginning, by exporting GIT_COMMITTER_DATE?\n"},{"id":"54396","messageId":"87hclck6qy.fsf@hariken.mwolson.org","threadId":"10084","inReplyTo":"7vps00ivgh.fsf@gitster.siamese.dyndns.org","subject":"Re: Script to backdate tags","fromName":"Michael Olson","fromEmail":"mwolson@gnu.org","sentAt":"2007-09-30T06:27:33Z","receivedAt":"2007-09-30T06:27:33Z","isPatch":false,"sender":{"key":"mwolson@gnu.org","avatar":"https://avatars.githubusercontent.com/u/1510193?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Michael Olson <mwolson@gnu.org> writes:\n>\n>> After importing one of my projects from Arch, I wanted to add tags\n>> that indicated its major releases.  Unfortunately, these tags for\n>> older releases would show up before the more recent releases in the\n>> gitweb output.  I searched in vain for a way of backdating tags, and\n>> finally decided to make a script to do this for me.  Here it is.\n>\n> Wouldn't it be easier to create the tag with the desired\n> timestamp from the beginning, by exporting GIT_COMMITTER_DATE?\n\nAh, I didn't know about that environment variable.\n\nWould it be possible to mention that option on the git-tag manpage?\nBackdating tags is very handy for projects which are converting their\nentire history from another VCS to git, and wish to denote releases that\nwere not previously tagged.  (Making a separate Arch branch for every\nsingle release was such a hassle that I didn't bother with it.  Git is\nmuch nicer in that area with its concept of tags and tag objects.)\n\n-- \n       Michael Olson -- FSF Associate Member #652     |\n http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\\ | | |\n            Sysadmin -- Hobbies: Lisp, GP2X, HCoop    | |_] | \\| |_|\nProjects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |\n"},{"id":"55897","messageId":"87lka4cllp.fsf@hariken.mwolson.org","threadId":"10084","inReplyTo":"7vd4w0iqd5.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Documentation/git-tag.txt: Document how to backdate tags","fromName":"Michael Olson","fromEmail":"mwolson@gnu.org","sentAt":"2007-10-15T17:51:30Z","receivedAt":"2007-10-15T17:51:30Z","isPatch":true,"sender":{"key":"mwolson@gnu.org","avatar":"https://avatars.githubusercontent.com/u/1510193?v=4"},"body":"Added a new section beneath \"On Automatic following\" called \"On\nBackdating Tags\".  This includes an explanation of when to use this\nmethod, a brief explanation of the kind of date that can be used in\nGIT_AUTHOR_DATE, and an example invocation of git-tag using a custom\nsetting of GIT_AUTHOR_DATE.\n\nSigned-off-by: Michael W. Olson <mwolson@gnu.org>\n---\n\n[Resending, this time without trying to send through Gmane and munge\nReply-To.]\n\nJunio C Hamano <gitster@pobox.com> writes:\n\n> Michael Olson <mwolson@gnu.org> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Wouldn't it be easier to create the tag with the desired\n>>> timestamp from the beginning, by exporting GIT_COMMITTER_DATE?\n>>\n>> Ah, I didn't know about that environment variable.\n>>\n>> Would it be possible to mention that option on the git-tag manpage?\n>\n> Surely, I am kind of surprised if it weren't, but apparently you\n> did not find it.  Please make it so.\n\n Documentation/git-tag.txt |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt\nindex 990ae4f..2966aa2 100644\n--- a/Documentation/git-tag.txt\n+++ b/Documentation/git-tag.txt\n@@ -214,6 +214,27 @@ having tracking branches.  Again, the heuristic to automatically\n follow such tags is a good thing.\n \n \n+On Backdating Tags\n+~~~~~~~~~~~~~~~~~~\n+\n+If you have imported some changes from another VCS and would like\n+to add tags for major releases of you work, it is useful to be able\n+to specify the date to embed inside of the tag object.  The data in\n+the tag object affects, for example, the ordering of tags in the\n+gitweb interface.\n+\n+To set the date used in future tag objects, set the environment\n+variable GIT_AUTHOR_DATE to one or more of the date and time.  The\n+date and time can be specified in a number of ways; the most common\n+is \"YYYY-MM-DD HH:MM\".\n+\n+An example follows.\n+\n+------------\n+$ GIT_AUTHOR_DATE=\"2006-10-02 10:31\" git tag -s v1.0.1\n+------------\n+\n+\n Author\n ------\n Written by Linus Torvalds <torvalds@osdl.org>,\n-- \n1.5.3.4\n"},{"id":"55911","messageId":"20071015203523.GA4428@sigill.intra.peff.net","threadId":"10084","inReplyTo":"87lka4cllp.fsf@hariken.mwolson.org","subject":"Re: [PATCH] Documentation/git-tag.txt: Document how to backdate tags","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-15T20:35:23Z","receivedAt":"2007-10-15T20:35:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Oct 15, 2007 at 01:51:30PM -0400, Michael Olson wrote:\n\n> +On Backdating Tags\n> +~~~~~~~~~~~~~~~~~~\n> +\n> +If you have imported some changes from another VCS and would like\n> +to add tags for major releases of you work, it is useful to be able\n\ns/you/your/\n\n-Peff\n"},{"id":"55919","messageId":"876418htvs.fsf@hariken.mwolson.org","threadId":"10084","inReplyTo":"20071015203523.GA4428@sigill.intra.peff.net","subject":"Re: [PATCH] Documentation/git-tag.txt: Document how to backdate tags","fromName":"Michael Olson","fromEmail":"mwolson@gnu.org","sentAt":"2007-10-15T22:53:43Z","receivedAt":"2007-10-15T22:53:43Z","isPatch":true,"sender":{"key":"mwolson@gnu.org","avatar":"https://avatars.githubusercontent.com/u/1510193?v=4"},"body":"Added a new section beneath \"On Automatic following\" called \"On\nBackdating Tags\".  This includes an explanation of when to use this\nmethod, a brief explanation of the kind of date that can be used in\nGIT_AUTHOR_DATE, and an example invocation of git-tag using a custom\nsetting of GIT_AUTHOR_DATE.\n\nSigned-off-by: Michael W. Olson <mwolson@gnu.org>\n---\n\nJeff King <peff@peff.net> writes:\n\n> On Mon, Oct 15, 2007 at 01:51:30PM -0400, Michael Olson wrote:\n>\n>> +On Backdating Tags\n>> +~~~~~~~~~~~~~~~~~~\n>> +\n>> +If you have imported some changes from another VCS and would like\n>> +to add tags for major releases of you work, it is useful to be able\n>\n> s/you/your/\n\nFixed; thanks.\n\n Documentation/git-tag.txt |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt\nindex 990ae4f..5cc9da4 100644\n--- a/Documentation/git-tag.txt\n+++ b/Documentation/git-tag.txt\n@@ -214,6 +214,27 @@ having tracking branches.  Again, the heuristic to automatically\n follow such tags is a good thing.\n \n \n+On Backdating Tags\n+~~~~~~~~~~~~~~~~~~\n+\n+If you have imported some changes from another VCS and would like\n+to add tags for major releases of your work, it is useful to be\n+able to specify the date to embed inside of the tag object.  The\n+data in the tag object affects, for example, the ordering of tags\n+in the gitweb interface.\n+\n+To set the date used in future tag objects, set the environment\n+variable GIT_AUTHOR_DATE to one or more of the date and time.  The\n+date and time can be specified in a number of ways; the most common\n+is \"YYYY-MM-DD HH:MM\".\n+\n+An example follows.\n+\n+------------\n+$ GIT_AUTHOR_DATE=\"2006-10-02 10:31\" git tag -s v1.0.1\n+------------\n+\n+\n Author\n ------\n Written by Linus Torvalds <torvalds@osdl.org>,\n-- \n1.5.3.4\n"}]}