Git fork

diff-index: restore -c/--cc options handling

This fixes 19b2517f (diff-merges: move specific diff-index "-m"
handling to diff-index, 2021-05-21).

That commit disabled handling of all diff for merges options in
diff-index on an assumption that they are unused. However, it later
appeared that -c and --cc, even though undocumented and not being
covered by tests, happen to have had particular effect on diff-index
output.

Restore original -c/--cc options handling by diff-index.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Sergey Organov and committed by
Junio C Hamano
5acffd34 225bc32a

+8 -14
+3 -3
builtin/diff-index.c
··· 29 29 prefix = precompose_argv_prefix(argc, argv, prefix); 30 30 31 31 /* 32 - * We need no diff for merges options, and we need to avoid conflict 33 - * with our own meaning of "-m". 32 + * We need (some of) diff for merges options (e.g., --cc), and we need 33 + * to avoid conflict with our own meaning of "-m". 34 34 */ 35 - diff_merges_suppress_options_parsing(); 35 + diff_merges_suppress_m_parsing(); 36 36 37 37 argc = setup_revisions(argc, argv, &rev, NULL); 38 38 for (i = 1; i < argc; i++) {
+4 -10
diff-merges.c
··· 6 6 static void set_separate(struct rev_info *revs); 7 7 8 8 static diff_merges_setup_func_t set_to_default = set_separate; 9 - static int suppress_parsing; 9 + static int suppress_m_parsing; 10 10 11 11 static void suppress(struct rev_info *revs) 12 12 { ··· 91 91 return 0; 92 92 } 93 93 94 - void diff_merges_suppress_options_parsing(void) 94 + void diff_merges_suppress_m_parsing(void) 95 95 { 96 - suppress_parsing = 1; 96 + suppress_m_parsing = 1; 97 97 } 98 98 99 99 int diff_merges_parse_opts(struct rev_info *revs, const char **argv) ··· 102 102 const char *optarg; 103 103 const char *arg = argv[0]; 104 104 105 - if (suppress_parsing) 106 - return 0; 107 - 108 - if (!strcmp(arg, "-m")) { 105 + if (!suppress_m_parsing && !strcmp(arg, "-m")) { 109 106 set_to_default(revs); 110 107 } else if (!strcmp(arg, "-c")) { 111 108 set_combined(revs); ··· 153 150 154 151 void diff_merges_setup_revs(struct rev_info *revs) 155 152 { 156 - if (suppress_parsing) 157 - return; 158 - 159 153 if (revs->combine_merges == 0) 160 154 revs->dense_combined_merges = 0; 161 155 if (revs->separate_merges == 0)
+1 -1
diff-merges.h
··· 11 11 12 12 int diff_merges_config(const char *value); 13 13 14 - void diff_merges_suppress_options_parsing(void); 14 + void diff_merges_suppress_m_parsing(void); 15 15 16 16 int diff_merges_parse_opts(struct rev_info *revs, const char **argv); 17 17