Re: diff-index --cc no longer permitted, gitk is now broken (slightly)
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Sep 8, 2021, 17:23 UTC
- Message-ID
- <cbd0d173-ef17-576b-ab7a-465d42c82265@kdbg.org>
- In-Reply-To
- <87pmtjkwsj.fsf@osv.gnss.ru>
Am 08.09.21 um 15:43 schrieb Sergey Organov:
> Besides, nobody yet told us why gitk uses --cc option in invocation of > 'diff-index' in the first place. Does it actually *rely* on particular > undocumented behavior of "diff-index --cc", or is it just a copy-paste > *leftover*?
No, it is not a left-over. The thing is,
- there is one point in the code where gitk adds options -p -C --cc (and more) to the command line (around line 8034),
- and there is a totally different point in the code where it is decided whether diff-index, diff-tree, or diff-files is invoked (proc diffcmd around line 7871).
IOW, Gitk expects that these option combinations can always be passed to all three commands.
Gitk does not want to look at a commit and then decide which incarnation of the command it wants to use (--cc vs. -p) depending on whether it is a merge commit or not. This decision is delegated to command that is invoked. Therefore, silent fall-back from --cc to -p in case of non-merge commits or non-conflicted index is absolutely necessary.
-- Hannes