{"thread":{"id":"21963","subject":"New Proposal (simple) for Metadata in Git Commits: git-meta","startedAt":"2009-12-15T21:27:03Z","lastAt":"2009-12-17T00:26:40Z","messageCount":4,"participants":["Sam Elliott","Shawn O. Pearce","Johan Herland"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129962","messageId":"93857A5A-744E-4A7C-B42D-23A56A48AAF7@lenary.co.uk","threadId":"21963","inReplyTo":null,"subject":"New Proposal (simple) for Metadata in Git Commits: git-meta","fromName":"Sam Elliott","fromEmail":"sam@lenary.co.uk","sentAt":"2009-12-15T21:27:03Z","receivedAt":"2009-12-15T21:27:03Z","isPatch":false,"sender":{"key":"sam@lenary.co.uk","avatar":null},"body":"Hi,\n\nI had this idea a day or so again, and have written a simple  \nimplementation to storing some semi-structured data in a git commit  \nmessage. This means that it's much easier for data to be found and  \nscraped from a certain commit, for instance what issue numbers commits  \nrefer to or close.\n\nThe entirety of the idea is expressed here: http://lenary.github.com/hackery/2009/12/git-meta/\n\nI have so far built an implementation of a way to get the data out of  \na commit. I am still investigating how to get this info into the  \ncommit message before the git-commit command so that it doesn't have  \nto be entirely hand-written.\n\nI was just looking for feedback and to see whether the mailing list  \nthinks this is a good idea or not? Any help would also be greatly  \nappreciated.\n\nThanks!\n\nSam\n--\nSam Elliott\nsam@lenary.co.uk\n--\n"},{"id":"129964","messageId":"20091215220529.GD18319@spearce.org","threadId":"21963","inReplyTo":"93857A5A-744E-4A7C-B42D-23A56A48AAF7@lenary.co.uk","subject":"Re: New Proposal (simple) for Metadata in Git Commits: git-meta","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-12-15T22:05:29Z","receivedAt":"2009-12-15T22:05:29Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Sam Elliott <sam@lenary.co.uk> wrote:\n> I had this idea a day or so again, and have written a simple  \n> implementation to storing some semi-structured data in a git commit  \n> message. This means that it's much easier for data to be found and  \n> scraped from a certain commit, for instance what issue numbers commits  \n> refer to or close.\n\nSo from your web page, this is basically just YAML shoved into the\nfooter of the message:\n\n--8<--\n\tWritten half of the functionality. Namely the querying half.\n\n\t---git-meta---\n\tawesome: true\n\tGithub:\n\t  user: lenary\n\t---git-meta---\n-->8--\n\n\nWhy do we need the --git-meta-- delimiter lines?\n\nJGit and Gerrit Code Review have already been following Git tradition\nby using footer messages as metadata.  E.g. we have lines like:\n\n--8<--\n    init: Don't abort on empty directory\n    \n    The following sequence should work:\n    \n      mkdir testgit\n      java -jar gerrit.war init -d testgit\n    \n    Since testgit is empty, it should be acceptable for us to populate the\n    directory with our files.\n    \n    Bug: issue 358\n    Change-Id: Ia85f31802066f8d39b042d3d057d33950a5035fd\n    Signed-off-by: Shawn O. Pearce <sop@google.com>\n-->8--\n\nThe JGit commit message parser has special logic to handle lines\nthat smell like one of these tag lines.  So long as there is no\nblank line in the footer paragraph, each of these tags can be read\nand processed.  Continuation lines should start with whitespace.\n\nI don't remember my YAML well enough, but isn't this existing\nstandard still parseable by a YAML processor?\n\nIf you dropped the --git-meta-- tags above, JGit would happily\nrecognize the awesome: and Github: tags, but it might need a bit\nmore work to recognize the nested user: tag.  Also, you'd be able\nto use git-meta on the git and Linux kernel repositories to pull\nout and work with Signed-off-by, Acked-by, etc.\n\n-- \nShawn.\n"},{"id":"129992","messageId":"20091216163036.GE18319@spearce.org","threadId":"21963","inReplyTo":"7349A827-41D5-434F-85FE-D49980A7D501@lenary.co.uk","subject":"Re: New Proposal (simple) for Metadata in Git Commits: git-meta","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-12-16T16:30:36Z","receivedAt":"2009-12-16T16:30:36Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Sam Elliott <sam@lenary.co.uk> wrote:\n> On 15 Dec 2009, at 23:05, Shawn O. Pearce wrote:\n>> If you dropped the --git-meta-- tags above, JGit would happily\n>> recognize the awesome: and Github: tags, but it might need a bit\n>> more work to recognize the nested user: tag.  Also, you'd be able\n>> to use git-meta on the git and Linux kernel repositories to pull\n>> out and work with Signed-off-by, Acked-by, etc.\n>\n> I'm not entirely sure about this approach. The current implementation  \n> also works with PGP-signed tags, where the information is not  \n> necessarily going to be at the bottom of the message when i use `git- \n> cat-file -p`. I think it shouldn't be too hard to also have git-meta  \n> read any YAML-like data just before the signing message.\n\nAh, good point.  But as you point out, it should be simple enough\nto detect a PGP signature on the bottom and just clip that off the\nend, and then perform the YAML-like data parsing on the footer.\n\n-- \nShawn.\n"},{"id":"130009","messageId":"200912170126.40566.johan@herland.net","threadId":"21963","inReplyTo":"20091216163036.GE18319@spearce.org","subject":"Re: New Proposal (simple) for Metadata in Git Commits: git-meta","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2009-12-17T00:26:40Z","receivedAt":"2009-12-17T00:26:40Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Wednesday 16 December 2009, Shawn O. Pearce wrote:\n> Sam Elliott <sam@lenary.co.uk> wrote:\n> > On 15 Dec 2009, at 23:05, Shawn O. Pearce wrote:\n> >> If you dropped the --git-meta-- tags above, JGit would happily\n> >> recognize the awesome: and Github: tags, but it might need a bit\n> >> more work to recognize the nested user: tag.  Also, you'd be able\n> >> to use git-meta on the git and Linux kernel repositories to pull\n> >> out and work with Signed-off-by, Acked-by, etc.\n> >\n> > I'm not entirely sure about this approach. The current implementation\n> > also works with PGP-signed tags, where the information is not\n> > necessarily going to be at the bottom of the message when i use `git-\n> > cat-file -p`. I think it shouldn't be too hard to also have git-meta\n> > read any YAML-like data just before the signing message.\n> \n> Ah, good point.  But as you point out, it should be simple enough\n> to detect a PGP signature on the bottom and just clip that off the\n> end, and then perform the YAML-like data parsing on the footer.\n\nI agree with Shawn's point that it should be possible to do this without \nembedding it in custom ---tags---.\n\nI would even try to parse the _entire_ commit message, and then discard \neverything that didn't match the \"<word>: <free-form value>\" format (with \npossible continuation lines). Even though this will generate some false \npositives (probably non-sensical \"key: value\" pairs), I don't see this as a \nmajor problem , since most users of this functionality are looking for a \nsmall set of specific keywords (which are even more unlikely to turn up as \nfalse positives)\n\nIn future versions of Git, you might also want to check for YAML-like data \nin the notes object corresponding to the commit in question (see git-notes \nin v1.6.6 for more details on the new notes feature). This would allow users \nto add/edit such metadata after the commit was made, without having to \nrewrite the commit itself.\n\n\nHave fun! :)\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"}]}