Re: [PATCH v1 5/9] diff-merges: move specific diff-index "-m" handling to diff-index
From: Junio C Hamano <hidden>
Date: 2021-05-17 20:11:26
Sergey Organov [off-list ref] writes:
Move specific handling of "-m" for diff-index to diff-index.c, so diff-merges is left to handle only diff for merges options. Being a better design by itself, this is especially essential in preparation for letting -m imply -p, as "diff-index -m" obviously should not imply -p, as it's entirely unrelated. To handle this, in addition to moving specific diff-index "-m" code out of diff-merges, we introduce new diff_merges_suppress_options_parsing() and call it before generic options processing in cmd_diff_index().
This change has a small but obvious fallout.
$ git diff-index -c --cached HEAD^
now starts failing loudly. Earlier, it silently fell back to
"combined" diff of one parent, which is "-p".
I think the end result is good (and luckily, "DIFF FORMAT FOR
MERGES" section explicitly limits "-c" and "--cc" to diff-tree,
diff-files and diff (and by implication excludes diff-index) so I am
sure there are small but non-zero number of people somewhere in the
world who has "diff-index -c" in their scripts that suddenly starts
failing with the version of Git with this change, but we can just
say their use was broken ;-)