git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: git@vger.kernel.org, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH] log: use true parents for diff even when rewriting
Date: Mon, 22 Jul 2013 14:48:25 -0700	[thread overview]
Message-ID: <7v61w2clli.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <a598aec3e3c90de4d2c08e58ee0a4828edc80ac2.1374527806.git.trast@inf.ethz.ch> (Thomas Rast's message of "Mon, 22 Jul 2013 23:22:01 +0200")

Thomas Rast <trast@inf.ethz.ch> writes:

> When using pathspec filtering in combination with diff-based log
> output, parent simplification happens before the diff is computed.
> The diff is therefore against the *simplified* parents.
>
> This works okay, arguably by accident, in the normal case: the pruned
> commits did not affect the paths being filtered, so the diff against
> the prune-result is the same as against the diff against the true
> parents.
>
> However, --full-diff breaks this guarantee, and indeed gives pretty
> spectacular results when comparing the output of
>
>   git log --graph --stat ...
>   git log --graph --full-diff --stat ...
>
> (--graph internally kicks in parent simplification, much like
> --parents).
>
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
> ---
>
> Perhaps like this.  It's getting a bit late, so I'm not sure if I'm
> missing another user of the "true" parent list, but it does fix the
> issue you reported.

Conceptually I can see how this will change the history
simplification in the vertical direction (skipping the ancestry
chain and jumping directly to the closest grandparent that touched
the specified path), but I am not sure how well this interacts with
history simplification in the horizontal direciton (culling
irrelevant side branches from the merge).

> @@ -2820,6 +2821,7 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
>  	if (action == commit_show &&
>  	    !revs->show_all &&
>  	    revs->prune && revs->dense && want_ancestry(revs)) {
> +		save_parents(commit);
>  		if (rewrite_parents(revs, commit, rewrite_one) < 0)
>  			return commit_error;
>  	}

After this, rewritten parent list may have shrunk by dropping
irrelevant side branches, but saved parents would have the full
parents list.  When we decide how to show diff depending on the
number of remaining parents, we would still use the rewritten
parents (which may have been reduced to a single strand of pearls)
and your change will use the original parents (which may be
multiple).

I also have to wonder if we always want to incur this save-parents
overhead, or we are better off limiting it to only when --full-diff
is in effect.

Thanks for getting the ball rolling, anyway.

  reply	other threads:[~2013-07-22 21:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22  9:08 git log anomalities Uwe Kleine-König
2013-07-22 10:40 ` Thomas Rast
2013-07-22 21:22 ` [PATCH] log: use true parents for diff even when rewriting Thomas Rast
2013-07-22 21:48   ` Junio C Hamano [this message]
2013-07-23  7:27     ` Thomas Rast
2013-07-23  7:49       ` Uwe Kleine-König
2013-07-23 19:55   ` Junio C Hamano
2013-07-31 20:13   ` [PATCH v2] " Thomas Rast
2013-07-31 22:55     ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v61w2clli.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=trast@inf.ethz.ch \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).