Re: diff-index --cc no longer permitted, gitk is now broken (slightly)

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

 



Jeff King <peff@xxxxxxxx> writes:

> On Mon, Aug 30, 2021 at 04:05:50PM +0300, Sergey Organov wrote:
>
>> > Is gitk wrong to add --cc unconditionally? Should it do so only when
>> > there are conflicts? Or not at all?
>> 
>> As far as I can tell, --cc had no effect on diff-index, it was just
>> silently consumed. If I'm right, this line in gitk never needed --cc.
>> Then either gitk is to be fixed, or we can "fix" diff-index to silently
>> consume --cc/-c again, for backward compatibility.
>
> I think it does have an effect. Try this to generate a simple merge
> conflict:
>
>   git init repo
>   cd repo
>
>   echo base >file
>   git add file
>   git commit -m base
>
>   echo main >file
>   git commit -am main
>
>   git checkout -b side HEAD^
>   echo side >file
>   git commit -am side
>
>   git merge main ;# maybe master here depending on your config
>
> And then with pre-v2.33 Git, --cc does a combined diff:
>
>   $ git.v2.32.0 diff-index -p  HEAD
>   diff --git a/file b/file
>   index 2299c37..81768df 100644
>   --- a/file
>   +++ b/file
>   @@ -1 +1,5 @@
>   +<<<<<<< HEAD
>    side
>   +=======
>   +main
>   +>>>>>>> main
>
>   $ git.v2.32.0 diff-index --cc HEAD
>   diff --cc file
>   index df967b9,2299c37..0000000
>   --- a/file
>   +++ b/file
>   @@@ -1,1 -1,1 +1,5 @@@
>   - base
>   ++<<<<<<< HEAD
>   + side
>   ++=======
>   ++main
>   ++>>>>>>> main
>
> Likewise, --raw will show a combined diff, though it's a bit less useful
> because the unmerged entry has a null sha1:
>
>   $ git.v2.32.0 diff-index HEAD
>   :100644 100644 2299c37978265a95cbe835a4b0f0bbf15aad5549 0000000000000000000000000000000000000000 M	file
>
>   $ git.v2.32.0 diff-index --cc --raw HEAD
>   ::100644 100644 100644 df967b96a579e45a18b8251732d16804b2e56a55 2299c37978265a95cbe835a4b0f0bbf15aad5549 0000000000000000000000000000000000000000 MM	file
>
> -Peff

Well, thanks! As it does make a difference, it's a pity it's neither
documented nor being tested.

I need to review the issue more closely to give a fix then.

Thanks,
-- Sergey Organov



[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]

  Powered by Linux