Subject: Re: Using Origin hashes to improve rebase behavior

From: Johan Herland <[email-masked]>
Date: Thu, 10 Feb 2011 23:16:23 +0100

On Thursday 10 February 2011, John Wiegley wrote:
> Is it allowable to add new metadata fields to a commit, and would this
> require bumping the repository version number?  Or should this be
> implemented by appending a Header-style textual field at the end of the
> commit message?

Many have tried before you to add such fields to the commit objects 
(including, literally, storing the origin of cherry-picks to help with 
rebases; search the archives for several examples). They have not succeeded. 
With good reason. This information does not belong in the commit object 
header section (see earlier discussions for a more complete rationale). 
Putting them at the end of the commit message is your best bet. Or even 
better: as a note object stored in a special-purpose notes ref (e.g. 
refs/notes/cherry-picks). The note approach also allows you to retroactively 
add this field to previous cherry-picks. AND it allows you to remove Origin-
IDs that refer to no-longer-existing commits. AND it pretty much solves the 
"git log should show this info" for you as well. In short, this is exactly 
the thing that notes were created to do.

Also, don't forget that the existing -x option to cherry-pick pretty much 
does exactly what you want to add to the commit object.

As for making use of this information in other git commands (e.g. rebase, 
log, etc.), you should show the list that the feature works well and solves 
Real Problems(tm) in the real world. If you can do so (with patches), and 
are willing to work with the list to address issues raised, and improve your 
patches, I'll guess you have a pretty good shot at getting this accepted.

AFAIK, nobody else is working in this area right now, although I don't read 
the mailing list religuously, so I may have missed things. As I said, others 
have previously proposed similar features, so you'll want to search the 
archive for those discussions to make sure you don't repeat the same 
mistakes.

Have fun! :)

...Johan

-- 
Johan Herland, <[email-masked]>
www.herland.net