Re: [PATCH v1 5/9] diff-merges: move specific diff-index "-m" handling to diff-index
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 17, 2021, 20:10 UTC
- Message-ID
- <xmqqwnrx5dfv.fsf@gitster.g>
- In-Reply-To
- <20210517155818.32224-6-sorganov@gmail.com>
Sergey Organov <sorganov@gmail.com> writes:
Show 13 quoted lines
> 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 ;-)