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

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

From
Brad King <brad.king@kitware.com>
Date
Nov 9, 2011, 22:19 UTC
Message-ID
<4EBAFC54.1090403@kitware.com>
In-Reply-To
<1320872495-7545-4-git-send-email-gitster@pobox.com>
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
Previous: Junio C Hamano
Message 5 of 5 in “commit-tree updates”
  1. 0/3 commit-tree updatesJunio C Hamano, Nov 9, 2011
  2. 1/3 commit-tree: update the command line parsingJunio C Hamano, Nov 9, 2011
  3. 2/3 commit-tree: teach -m/-F options to read logs from elsewhereJunio C Hamano, Nov 9, 2011
  4. 3/3 commit-tree: teach -x <extra>Junio C Hamano, Nov 9, 2011
  5. Brad KingNov 9, 2011

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.