threads / discuss / 19054

Extra metadata in the commit?

Subject: Extra metadata in the commit?

## tl;dr

5 messages between Apr 24, 2009 and Apr 25, 2009.

replies: 4people: 5as markdown or json

Scott Chacon· Apr 24, 2009, 22:47 UTC · lore
Hey all,

I'm working on a hg<->git bidirectional tool using Git as the communication protocol, so there is a bunch of Hg metadata that I need to keep in Git to ensure I can convert commits created in Hg back into the exact same objects after they upload to the Git db and then come back down. This means storing explicit rename info, branch names, etc somewhere without messing up Git clients that want to work on the same repo. So, I can keep this data in the commit message, but I thought it would be cleaner to keep it as extra fields in the commit object before the "\n\n" separator. Before I go too far down this road, is there anything horrible that might happen in any of the core Git tools if extra data is there?

Thanks, Scott

Junio C Hamano· Apr 24, 2009, 23:06 UTC · re: Scott Chacon · lore

Re: Extra metadata in the commit?

Scott Chacon <schacon@gmail.com> writes:
Show 11 quoted lines
> I'm working on a hg<->git bidirectional tool using Git as the
> communication protocol, so there is a bunch of Hg metadata that I need
> to keep in Git to ensure I can convert commits created in Hg back into
> the exact same objects after they upload to the Git db and then come
> back down.  This means storing explicit rename info, branch names, etc
> somewhere without messing up Git clients that want to work on the same
> repo.  So, I can keep this data in the commit message, but I thought
> it would be cleaner to keep it as extra fields in the commit object
> before the "\n\n" separator.  Before I go too far down this road, is
> there anything horrible that might happen in any of the core Git tools
> if extra data is there?

Not that I know of but it is highly unlikely that such a patch will be accepted, given the history of discussion around that area.

Johannes Schindelin· Apr 24, 2009, 23:55 UTC · re: Scott Chacon · lore

Re: Extra metadata in the commit?

Hi,
On Fri, 24 Apr 2009, Scott Chacon wrote:
Show 9 quoted lines
> I'm working on a hg<->git bidirectional tool using Git as the 
> communication protocol, so there is a bunch of Hg metadata that I need 
> to keep in Git to ensure I can convert commits created in Hg back into 
> the exact same objects after they upload to the Git db and then come 
> back down.  This means storing explicit rename info, branch names, etc 
> somewhere without messing up Git clients that want to work on the same 
> repo.  So, I can keep this data in the commit message, but I thought it 
> would be cleaner to keep it as extra fields in the commit object before 
> the "\n\n" separator.

I'd suggest keeping it in the commit body, for better visibility and easier handling by tools.

Ciao, Dscho

Alex Riesen· Apr 25, 2009, 09:49 UTC · re: Johannes Schindelin · lore

Re: Extra metadata in the commit?

2009/4/25 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
Show 15 quoted lines
> On Fri, 24 Apr 2009, Scott Chacon wrote:
>
>> I'm working on a hg<->git bidirectional tool using Git as the
>> communication protocol, so there is a bunch of Hg metadata that I need
>> to keep in Git to ensure I can convert commits created in Hg back into
>> the exact same objects after they upload to the Git db and then come
>> back down.  This means storing explicit rename info, branch names, etc
>> somewhere without messing up Git clients that want to work on the same
>> repo.  So, I can keep this data in the commit message, but I thought it
>> would be cleaner to keep it as extra fields in the commit object before
>> the "\n\n" separator.
>
> I'd suggest keeping it in the commit body, for better visibility and
> easier handling by tools.
>

BTW, by the same convention we treat the very first line of a commit message specially, we can say that the last line, if non-empty (IOW, does not end with \n), is treated specially by UI tools (grayed out, for example):

  Subject\n
  \n
  Body\n
  \n
  something:very:special
Johan Herland· Apr 25, 2009, 12:08 UTC · re: Johannes Schindelin · lore

Re: Extra metadata in the commit?

On Saturday 25 April 2009, Johannes Schindelin wrote:
Show 7 quoted lines
> On Fri, 24 Apr 2009, Scott Chacon wrote:
> > So, I can keep this data in the commit message, but I thought it
> > would be cleaner to keep it as extra fields in the commit object before
> > the "\n\n" separator.
>
> I'd suggest keeping it in the commit body, for better visibility and
> easier handling by tools.

Or even better: Keep it in separate commit notes (provided you can wait for the js/notes topic in pu to make it into a release). If you add the notes with GIT_NOTES_REF=refs/notes/hg_metadata, you will also keep them nicely out of the way of everybody else.

(I'm using this approach when building a bidirectional CVS <-> Git helper on top of Barkalow's foreign-scm topic).

Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net

← back to recent threads