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

Re: [PATCH 2/3] commit: add function to unparse a commit and its parents

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2009, 06:27 UTC
Message-ID
<7v3ab3exht.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090517153647.6403.44036.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> Its parents are recursively unparsed too, because they might have
> been changed. But its tree is not unparsed as it should not have
> been modifed.

It is a bug in any codepath if it used commit->tree without first checking if commit->parsed is true to begin with, so you could NULLify commit->tree but that shouldn't make any difference. I agree leaving the tree object as-is would make sense.

I am not convinced that unparsing all the _remaining_ parents recursively like your patch does is enough. Isn't there a codepath that

 - parses a commit A to find list of true parents X, Y, Z;
 - iterates over that list and descend into one of these parents X, doing
   nasty things such as pruning its parents list after parsing it; and
 - decides to prune that parent X from the parent list, making the parent
   list of A into Y and Z?

After such a sequence, calling your unparse_commit(A) will unparse A and remaining parents of Y and Z, but will still leave X in the dirty state.

Previous: Christian CouderNext: Christian Couder
Message 3 of 13 in “bisect: rework some rev related functions to make them more reusable”
  1. 1/3 bisect: rework some rev related functions to make them more reusableChristian Couder, May 17, 2009
  2. 2/3 commit: add function to unparse a commit and its parentsChristian Couder, May 17, 2009
  3. Junio C HamanoMay 18, 2009
  4. Christian CouderMay 19, 2009
  5. Junio C HamanoMay 19, 2009
  6. Jakub NarebskiMay 19, 2009
  7. Miles BaderMay 19, 2009
  8. Junio C HamanoMay 19, 2009
  9. Jakub NarebskiMay 19, 2009
  10. Johannes SixtMay 25, 2009
  11. Johannes SchindelinMay 25, 2009
  12. Christian CouderMay 27, 2009
  13. 3/3 bisect: check ancestors without forking a "git rev-list" processChristian Couder, May 17, 2009

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.