diffcore-pickaxe: respect --no-textconv

git log -S doesn't respect --no-textconv: $ echo '*.txt diff=wrong' > .gitattributes $ git -c diff.wrong.textconv='xxx' log --no-textconv -Sfoo error: cannot run xxx: No such file or directory fatal: unable to read files to diff Reported-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Simon Ruderich <simon@ruderich.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Simon Ruderich committed Apr 5, 2013 at 15:16 UTC a8f6109428b868611c0a59e6894e2b6b38c34e1b
2 files changed +36 -4
diffcore-pickaxe.c
+8 -4
@@ -86,8 +86,10 @@ static int diff_grep(struct diff_filepair *p, struct diff_options *o,
86 if (diff_unmodified_pair(p))
87 return 0;
88
89 - textconv_one = get_textconv(p->one);
90 - textconv_two = get_textconv(p->two);
89 + if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
90 + textconv_one = get_textconv(p->one);
91 + textconv_two = get_textconv(p->two);
92 + }
93
94 mf1.size = fill_textconv(textconv_one, p->one, &mf1.ptr);
95 mf2.size = fill_textconv(textconv_two, p->two, &mf2.ptr);
@@ -201,8 +203,10 @@ static int has_changes(struct diff_filepair *p, struct diff_options *o,
203 if (!o->pickaxe[0])
204 return 0;
205
204 - textconv_one = get_textconv(p->one);
205 - textconv_two = get_textconv(p->two);
206 + if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
207 + textconv_one = get_textconv(p->one);
208 + textconv_two = get_textconv(p->two);
209 + }
210
211 /*
212 * If we have an unmodified pair, we know that the count will be the
t/t4209-log-pickaxe.sh
+28
@@ -80,6 +80,20 @@ test_expect_success 'log -G -i (match)' '
80 test_cmp expect actual
81 '
82
83 +test_expect_success 'log -G --textconv (missing textconv tool)' '
84 + echo "* diff=test" >.gitattributes &&
85 + test_must_fail git -c diff.test.textconv=missing log -Gfoo &&
86 + rm .gitattributes
87 +'
88 +
89 +test_expect_success 'log -G --no-textconv (missing textconv tool)' '
90 + echo "* diff=test" >.gitattributes &&
91 + git -c diff.test.textconv=missing log -Gfoo --no-textconv >actual &&
92 + >expect &&
93 + test_cmp expect actual &&
94 + rm .gitattributes
95 +'
96 +
97 test_expect_success 'log -S (nomatch)' '
98 git log -Spicked --format=%H >actual &&
99 >expect &&
@@ -116,4 +130,18 @@ test_expect_success 'log -S -i (nomatch)' '
130 test_cmp expect actual
131 '
132
133 +test_expect_success 'log -S --textconv (missing textconv tool)' '
134 + echo "* diff=test" >.gitattributes &&
135 + test_must_fail git -c diff.test.textconv=missing log -Sfoo &&
136 + rm .gitattributes
137 +'
138 +
139 +test_expect_success 'log -S --no-textconv (missing textconv tool)' '
140 + echo "* diff=test" >.gitattributes &&
141 + git -c diff.test.textconv=missing log -Sfoo --no-textconv >actual &&
142 + >expect &&
143 + test_cmp expect actual &&
144 + rm .gitattributes
145 +'
146 +
147 test_done