git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: understand Diff Formatting --cc flag?

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 16, 2022, 16:04 UTC
Message-ID
<xmqq8rt9opd1.fsf@gitster.g>
In-Reply-To
<CAJcwCMMMm=ZnkV3Xxbf+CpJqhRGx1KrdUzh90W-9dEPJ+i40xg@mail.gmail.com>
Andy Zhang <zhgdrx@gmail.com> writes:
Show 11 quoted lines
> 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.

Previous: Andy ZhangNext: Andy Zhang
Message 2 of 5 in “understand Diff Formatting --cc flag?”
  1. Andy ZhangMar 16, 2022
  2. Junio C HamanoMar 16, 2022
  3. Andy ZhangMar 16, 2022
  4. Andy ZhangMar 16, 2022
  5. Junio C HamanoMar 16, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.