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, 19:39 UTC
Message-ID
<xmqqk0ctlmaw.fsf@gitster.g>
In-Reply-To
<CAJcwCMN67UMjSNqf2wbb5ZhK1QGicn7+ihneOc1XxJsdDVtvTw@mail.gmail.com>
Andy Zhang <zhgdrx@gmail.com> writes:
Show 13 quoted lines
>> 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).
>>
>
> [Andy wrote:] as per your comments, The 3 variants are indeed into the
> following 3 groups.
> My question is: why can #1 appear inside multiple groups? A and B.
>    <group-A> parent#1, #3, #4;
>    <group-B> parent#2, #1;
>    <group-C> parent#5, #4;

The three variants in my sample scenario were (A) used by #1, (B) used by #3, and (C) used by #4. #2 uses (A) and #5 uses (C).

The contents of #1 does appear twice, in #1 itself and also in #2. That is what "#2 has the same contents as #1" means.

> [Andy wrote:] can I explain  "--cc" flag as:
> "--cc lists only either hunks which were modified from all parents, or
> hunks which were modified from at least two parents and they had
> different variants"

I do not have time to see if that matches the official explanation found in "git diff --help", which I just re-read and I think it gives the right definition.

Previous: Andy Zhang
Message 5 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.