git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: New Proposal (simple) for Metadata in Git Commits: git-meta

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 15, 2009, 22:05 UTC
Message-ID
<20091215220529.GD18319@spearce.org>
In-Reply-To
<93857A5A-744E-4A7C-B42D-23A56A48AAF7@lenary.co.uk>
Sam Elliott <sam@lenary.co.uk> wrote:
Show 5 quoted lines
> I had this idea a day or so again, and have written a simple  
> implementation to storing some semi-structured data in a git commit  
> message. This means that it's much easier for data to be found and  
> scraped from a certain commit, for instance what issue numbers commits  
> refer to or close.

So from your web page, this is basically just YAML shoved into the footer of the message:

--8<--
	Written half of the functionality. Namely the querying half.
	---git-meta---
	awesome: true
	Github:
	  user: lenary
	---git-meta---
-->8--
Why do we need the --git-meta-- delimiter lines?

JGit and Gerrit Code Review have already been following Git tradition by using footer messages as metadata. E.g. we have lines like:

--8<--
    init: Don't abort on empty directory
    
    The following sequence should work:
    
      mkdir testgit
      java -jar gerrit.war init -d testgit
    
    Since testgit is empty, it should be acceptable for us to populate the
    directory with our files.
    
    Bug: issue 358
    Change-Id: Ia85f31802066f8d39b042d3d057d33950a5035fd
    Signed-off-by: Shawn O. Pearce <sop@google.com>
-->8--

The JGit commit message parser has special logic to handle lines that smell like one of these tag lines. So long as there is no blank line in the footer paragraph, each of these tags can be read and processed. Continuation lines should start with whitespace.

I don't remember my YAML well enough, but isn't this existing standard still parseable by a YAML processor?

If you dropped the --git-meta-- tags above, JGit would happily recognize the awesome: and Github: tags, but it might need a bit more work to recognize the nested user: tag. Also, you'd be able to use git-meta on the git and Linux kernel repositories to pull out and work with Signed-off-by, Acked-by, etc.

-- 
Shawn.
Previous: Sam ElliottNext: Shawn O. Pearce
Message 2 of 4 in “New Proposal (simple) for Metadata in Git Commits: git-meta”
  1. Sam ElliottDec 15, 2009
  2. Shawn O. PearceDec 15, 2009
  3. Shawn O. PearceDec 16, 2009
  4. Johan HerlandDec 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.