]> rtime.felk.cvut.cz Git - git.git/commitdiff
Merge branch 'tr/word-diff'
authorJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:17 +0000 (04:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:17 +0000 (04:02 -0700)
* tr/word-diff:
  diff: add --word-diff option that generalizes --color-words

Conflicts:
diff.c

1  2 
Documentation/diff-options.txt
Documentation/gitattributes.txt
diff.c

Simple merge
Simple merge
diff --cc diff.c
index 43a313deba54ee6b943dd86c8db6675b145b092a,d81a57a3c415ec7191ef0c686f8e2134d5b7ee0c..502b301670a13ae146974d8ba4a956c2f6e3dbf3
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -683,7 -748,9 +736,8 @@@ static void diff_words_show(struct diff
  {
        xpparam_t xpp;
        xdemitconf_t xecfg;
 -      xdemitcb_t ecb;
        mmfile_t minus, plus;
+       struct diff_words_style *style = diff_words->style;
  
        /* special case: only removal */
        if (!diff_words->plus.text.size) {
@@@ -1759,10 -1838,23 +1823,23 @@@ static void builtin_diff(const char *na
                                        die ("Invalid regular expression: %s",
                                                        o->word_regex);
                        }
+                       for (i = 0; i < ARRAY_SIZE(diff_words_styles); i++) {
+                               if (o->word_diff == diff_words_styles[i].type) {
+                                       ecbdata.diff_words->style =
+                                               &diff_words_styles[i];
+                                       break;
+                               }
+                       }
+                       if (DIFF_OPT_TST(o, COLOR_DIFF)) {
+                               struct diff_words_style *st = ecbdata.diff_words->style;
+                               st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
+                               st->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);
+                               st->ctx.color = diff_get_color_opt(o, DIFF_PLAIN);
+                       }
                }
                xdi_diff_outf(&mf1, &mf2, fn_out_consume, &ecbdata,
 -                            &xpp, &xecfg, &ecb);
 +                            &xpp, &xecfg);
-               if (DIFF_OPT_TST(o, COLOR_DIFF_WORDS))
+               if (o->word_diff)
                        free_diff_words_data(&ecbdata);
                if (textconv_one)
                        free(mf1.ptr);