From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
Tim Jaacks <tim.jaacks@garz-fricke.com>,
Chris Torek <chris.torek@gmail.com>
Subject: Re: [PATCH 6/6] revision: add parents after child for ^!
Date: Fri, 16 Sep 2022 08:55:45 -0700 [thread overview]
Message-ID: <xmqqh717jou6.fsf@gitster.g> (raw)
In-Reply-To: <29d50baa-1923-38e1-6ecb-73840376d28e@web.de> ("René Scharfe"'s message of "Fri, 16 Sep 2022 11:02:01 +0200")
René Scharfe <l.s.r@web.de> writes:
> "git diff A B", "git diff A..B", "git diff ^A B" and "git diff "B ^A"
> all produce the same output. So I suspect we could reverse the order
> for A..B as well without ill effect if we wanted.
Yup.
>> Can't we "fix" it at the consumer end, perhaps by checking where
>> these commits came from by looking at rev.cmdline?
>
> We could.
Yeah, doing so may be more in line with how two-tree comparison is
parsed (your observation above on four combinations).
> --- >8 ---
> Subject: [PATCH] diff: support ^! for merges
>
> revision.c::handle_revision_arg_1() resolves <rev>^! by first adding the
> negated parents and then <rev> itself. builtin_diff_combined() expects
> the first tree to be the merge and the remaining ones to be the parents,
> though. This mismatch results in bogus diff output.
>
> Remember the first tree that doesn't belong to a parent and use it
> instead of blindly picking the first one. This makes "git diff <rev>^!"
> consistent with "git show <rev>^!".
>
> Reported-by: Tim Jaacks <tim.jaacks@garz-fricke.com>
> Suggested-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> The check "i < rev.cmdline.nr" is necessary to avoid segfaults e.g.
> in t0005. I wonder why. Shouldn't rev.pending.objects and
> rev.cmdline.rev always have the same number of entries?
Things that did not come from command line can go into pending,
can't they? E.g. add_head_to_pending(), when lack of rev defaults
to "HEAD", touches pending without touching cmdline?
next prev parent reply other threads:[~2022-09-16 15:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 14:48 [PATCH 0/6] revision: fix order of revs for ^! René Scharfe
2022-09-15 14:51 ` [PATCH 1/6] revision: use strtol_i() for exclude_parent René Scharfe
2022-09-17 0:59 ` Chris Torek
2022-09-15 14:52 ` [PATCH 2/6] revision: factor out get_commit() René Scharfe
2022-09-15 14:52 ` [PATCH 3/6] revision: factor out add_parent() René Scharfe
2022-09-15 14:53 ` [PATCH 4/6] revision: factor out add_parents() René Scharfe
2022-09-15 14:54 ` [PATCH 5/6] revision: rename add_parents_only() to add_nth_parent() René Scharfe
2022-09-15 14:55 ` [PATCH 6/6] revision: add parents after child for ^! René Scharfe
2022-09-15 17:53 ` Junio C Hamano
2022-09-16 9:02 ` René Scharfe
2022-09-16 15:55 ` Junio C Hamano [this message]
2022-09-18 5:36 ` René Scharfe
2022-10-01 10:23 ` [PATCH v3 0/3] diff: support ^! for merges René Scharfe
2022-10-01 10:25 ` [PATCH v3 1/3] revision: use strtol_i() for exclude_parent René Scharfe
2022-10-01 10:26 ` [PATCH v3 2/3] revisions.txt: unspecify order of resolved parts of ^! René Scharfe
2022-10-01 10:28 ` [PATCH v3 3/3] diff: support ^! for merges René Scharfe
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=xmqqh717jou6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chris.torek@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=tim.jaacks@garz-fricke.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.
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).