From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] commit: add function to unparse a commit and its parents
Date: Tue, 19 May 2009 06:16:29 +0200 [thread overview]
Message-ID: <200905190616.30132.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7v3ab3exht.fsf@alter.siamese.dyndns.org>
Le lundi 18 mai 2009, Junio C Hamano a écrit :
> 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.
I agree that unparsing all the remaining parents recursively may not be
enough in some cases, but I don't know much about these cases. Is it only
when revs->prune is set?
I think it should be ok when checking that all good revs are ancestor of the
bad rev, but I may be missing something.
It should be ok too when using "git replace" and/or grafts as the parent
list of a commit should be changed before its parents are changed.
I also found the clear_commit_marks function that could be used when
checking ancestors so I will resend a patch series using it and without
patch 2/3. But I can continue to work on unparsing commits to improve
the "git replace" series. I need to find some test cases though, and I
cannot think of any interesting one right now.
By the way, when you say that you suspect an attempt to replace an object
that is directly listed on the command line would not work very well with
the current replace series, is it related to the unparsing commit problem?
Thanks,
Christian.
next prev parent reply other threads:[~2009-05-19 4:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090517153307.6403.73576.>
2009-05-17 15:36 ` [PATCH 1/3] bisect: rework some rev related functions to make them more reusable Christian Couder
2009-05-17 15:36 ` [PATCH 2/3] commit: add function to unparse a commit and its parents Christian Couder
2009-05-18 6:27 ` Junio C Hamano
2009-05-19 4:16 ` Christian Couder [this message]
2009-05-19 5:20 ` Junio C Hamano
2009-05-19 6:35 ` Jakub Narebski
2009-05-19 7:02 ` Miles Bader
2009-05-19 7:14 ` Junio C Hamano
2009-05-19 7:48 ` Jakub Narebski
2009-05-25 9:17 ` Johannes Sixt
2009-05-25 9:46 ` Johannes Schindelin
2009-05-27 5:12 ` Christian Couder
2009-05-17 15:36 ` [PATCH 3/3] bisect: check ancestors without forking a "git rev-list" process Christian Couder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905190616.30132.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).