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

Re: How to add custom metadata to Git commit object

From
KKKonstantin Khomoutov <kostix+git@007spb.ru>
Date
May 30, 2016, 18:24 UTC
Message-ID
<20160530212438.32d863cf1448361d286bdcb4@domain007.com>
In-Reply-To
<959E96F7-0FF3-4336-B098-58836136DB08@jetbrains.com>

On Mon, 30 May 2016 20:58:08 +0300 Kirill Likhodedov <kirill.likhodedov@jetbrains.com> wrote:

Show 7 quoted lines
> Is it possible to add custom metadata to Git commit object? 
> Such metadata should be ignored by Git commands, but could be used by
> a 3-party tool which knows the format and knows where to look. 
> 
> I assume that this should be possible, given that Git objects are
> actually patches, and patches can contain additional details. But can
> this be done with the help of Git commands? 
[...]
> There are git-notes, which could be used for the purpose, but they
> are visible to the user via standard Git command, and could be used
> by the user for other purposes, so they are not very suitable for the
> task.

AFAIK, within your restrictions, it's not possible because there are only two ways to add meta information for a Git commit:

* Store it externally and somehow correlate it with the commit.
  This is what git-notes does.
* Encode it directly into a commit object.
  Since you can't use your own headers in commit objects,
  you have to encode this information into the commit message in some
  form parsable by a machine.   This is what, say, git-svn does to
  make it possible to correlate the commits it creates with their source
  Subversion revisions.
In both cases the information can be viewed by the user.

What I can't really understand is what is so bad about the user being able to peer at that data.

Previous: Kirill LikhodedovNext: Jeff King
Message 2 of 6 in “How to add custom metadata to Git commit object”
  1. Kirill LikhodedovMay 30, 2016
  2. Konstantin KhomoutovMay 30, 2016
  3. Jeff KingMay 30, 2016
  4. Junio C HamanoMay 30, 2016
  5. Kirill LikhodedovMay 31, 2016
  6. Junio C HamanoMay 31, 2016

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.