author | Junio C Hamano <gitster@pobox.com> | |
Fri, 21 May 2010 11:02:17 +0000 (04:02 -0700) | ||
committer | Junio 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
diff: add --word-diff option that generalizes --color-words
Conflicts:
diff.c
1 | 2 | |||
---|---|---|---|---|
Documentation/diff-options.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/gitattributes.txt | patch | | diff1 | | diff2 | | blob | history |
diff.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/diff-options.txt
Simple merge
diff --cc Documentation/gitattributes.txt
Simple merge
diff --cc diff.c
index 43a313deba54ee6b943dd86c8db6675b145b092a,d81a57a3c415ec7191ef0c686f8e2134d5b7ee0c..502b301670a13ae146974d8ba4a956c2f6e3dbf3
+++ b/diff.c
{
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) {
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);