Subject: Re: [PATCH 3/3] commit-tree: teach -x <extra>

From: Brad King <[email-masked]>
Date: Wed, 09 Nov 2011 17:19:00 -0500

On 11/9/2011 4:01 PM, Junio C Hamano wrote:
> By feeding the header part of the original commit with this parameter,
> e.g. -x "$(git cat-file commit $commit | sed -n -e /^$/q -e p)", extra
> headers of another commit can be transplanted to the resulting commit.

One of the interface features typical in git plumbing that I've always liked
is that any place that can pass long strings tends to be implemented using
pipes or files, at least optionally.  This is especially helpful for operating
systems that have severe limitations on total command line size.

I suggest a flag (-X ?) that tells commit-tree to treat the commit message
(from wherever it is read) in "cat-file commit" format.  Read the extra
header lines from the part before the blank line, and the rest of the message
normally after the blank line.  For example:

  (git cat-file commit $commit | sed -n -e /^$/q -e p
   echo ''
   echo 'New commit message') |
  git commit-tree -X -p $parent $tree

If we want the original extended headers and the original message:

  git cat-file commit $commit | git commit-tree -X -p $parent $tree

-Brad