From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: "Jeff King" <peff@peff.net>,
git@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Ramsay Jones" <ramsay@ramsay1.demon.co.uk>
Subject: Re: [PATCH] log: use true parents for diff when walking reflogs
Date: Mon, 05 Aug 2013 12:16:01 -0700 [thread overview]
Message-ID: <7vd2psj6dq.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: d6dadc4ab54d81490ca46bcfbd44a61be24f6eb7.1375524982.git.trast@inf.ethz.ch
Thomas Rast <trast@inf.ethz.ch> writes:
> The reflog walking logic (git log -g) replaces the true parent list
> with the preceding commit in the reflog. This results in bogus commit
> diffs when combined with options such as -p; the diff is against the
> reflog predecessor, not the parent of the commit.
>
> Save the true parents on the side, extending the functions from the
> previous commit. The diff logic picks them up and uses them to show
> the correct diffs.
>
> We do have to be somewhat careful about repeated calling of
> save_parents(), since the reflog may list a commit more than once. We
> now store (commit_list*)-1 to distinguish the "not saved yet" and
> "root commit" cases. This lets us preserve an empty parent list even
> if save_parents() is repeatedly called.
>
> Suggested-by: Jeff King <peff@peff.net>
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
> ---
>
> Jeff King <peff@peff.net> wrote:
>>
>> Your description (and solution) make a lot of sense to me. Another code
>> path that has a similar problem is the "-g" reflog walker. It rewrites
>> the parents based on the reflog, and the diffs it produces are mostly
>> useless (e.g., try "git stash list -p").
>>
>> Should we be applying the same technique there?
>
> Good point. This is how. It applies on top of the other patch.
Thanks.
> It doesn't really help for 'git stash list -p', though, because
> stashes are merge commits. Now they just don't show anything.
> could try 'git stash list -p -m', though.
Using --first-parent may be more convenient and useful.
prev parent reply other threads:[~2013-08-05 19:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-03 10:36 [PATCH] log: use true parents for diff when walking reflogs Thomas Rast
2013-08-03 10:40 ` Thomas Rast
2013-08-05 19:16 ` Junio C Hamano [this message]
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=7vd2psj6dq.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=ramsay@ramsay1.demon.co.uk \
--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).