Re: [PATCH] log: use true parents for diff when walking reflogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Rast <trast@xxxxxxxxxxx> 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@xxxxxxxx>
> Signed-off-by: Thomas Rast <trast@xxxxxxxxxxx>
> ---
>
> Jeff King <peff@xxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]