git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andy Zhang <zhgdrx@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: understand Diff Formatting --cc flag?
Date: Wed, 16 Mar 2022 09:04:42 -0700	[thread overview]
Message-ID: <xmqq8rt9opd1.fsf@gitster.g> (raw)
In-Reply-To: <CAJcwCMMMm=ZnkV3Xxbf+CpJqhRGx1KrdUzh90W-9dEPJ+i40xg@mail.gmail.com> (Andy Zhang's message of "Wed, 16 Mar 2022 19:36:25 +0800")

Andy Zhang <zhgdrx@gmail.com> writes:

> understand Diff Formatting --cc flag?
>
> hi,
>
>   It is really too hard to understand Diff Formatting --cc flag.
>
>   It is hard to understand"...hunks whose contents in the parents have
> only two variants..".
>
>   My question is:
>    1)what does "variant" mean here?

You may be comparing a merge of 5 parents into 1 child.  There are 5
pairwise comparison (parent#1 with the child, parent#2 with the
child, ..., parent#5 with the child).

Among 5 parents, perhaps parent#1 and parent#2 had the same contents,
and parent#4 and parent#5 had the same contents, different from what
parent#1 and parent#3 had.  You have 3 variants (parent#1's, #3's
and #4's; parent#2 has the same contents as #1, parent#5 has the
same contents as #4).

>    2)what about all the other cases? 0 variants, 1 variants, and 3
> variants and even more?

By definition, you wouldn't be making any comparison if there are 0
variants.  1 variant means all the parents are identical, so
whichever parent you are interested in, the difference to the child
is interesting---such a change can only come from the person who
merged adding a change that no parent wanted to have.  If many
parents are different then showing the comparison with the final
resolution from them is useful.  The case that is not so interesting
is when one set of parents had something (call it A), and the other
set of parents had something else (B), and the result is A.  There is
no interesting merge conflict in there.


  reply	other threads:[~2022-03-16 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 11:36 understand Diff Formatting --cc flag? Andy Zhang
2022-03-16 16:04 ` Junio C Hamano [this message]
2022-03-16 18:57   ` Andy Zhang
2022-03-16 19:00   ` Andy Zhang
2022-03-16 19:39     ` Junio C Hamano

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=xmqq8rt9opd1.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=zhgdrx@gmail.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).