Thread (1 message) 1 message, 1 author, 2021-05-17

Re: [PATCH v1 5/9] diff-merges: move specific diff-index "-m" handling to diff-index

From: Sergey Organov <hidden>
Date: 2021-05-17 20:24:23

Junio C Hamano [off-list ref] writes:
Sergey Organov [off-list ref] writes:
quoted
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 ;-)
Well, I'm not sure. If it's a problem, I think I can add -c/--cc parsing
to diff-index that will simply imply -p. This way we will be more
backward-compatible.

Thanks,

-- Sergey Organov.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help