textconv: use shell to run helper
Currently textconv helpers are run directly. Running through the shell is useful because the user can provide a program with command line arguments, like "antiword -f". It also makes textconv more consistent with other parts of git, most of which run their helpers using the shell. The downside is that textconv helpers with shell metacharacters (like space) in the filename will be broken. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
bac8037081
commit
41a457e4f8
1
diff.c
1
diff.c
@ -3771,6 +3771,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
|
|||||||
*arg = NULL;
|
*arg = NULL;
|
||||||
|
|
||||||
memset(&child, 0, sizeof(child));
|
memset(&child, 0, sizeof(child));
|
||||||
|
child.use_shell = 1;
|
||||||
child.argv = argv;
|
child.argv = argv;
|
||||||
child.out = -1;
|
child.out = -1;
|
||||||
if (start_command(&child) != 0 ||
|
if (start_command(&child) != 0 ||
|
||||||
|
@ -48,7 +48,7 @@ test_expect_success 'file is considered binary by plumbing' '
|
|||||||
|
|
||||||
test_expect_success 'setup textconv filters' '
|
test_expect_success 'setup textconv filters' '
|
||||||
echo file diff=foo >.gitattributes &&
|
echo file diff=foo >.gitattributes &&
|
||||||
git config diff.foo.textconv "$PWD"/hexdump &&
|
git config diff.foo.textconv "\"$PWD\""/hexdump &&
|
||||||
git config diff.fail.textconv false
|
git config diff.fail.textconv false
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ chmod +x dump
|
|||||||
|
|
||||||
test_expect_success 'setup textconv' '
|
test_expect_success 'setup textconv' '
|
||||||
echo file diff=foo >.gitattributes &&
|
echo file diff=foo >.gitattributes &&
|
||||||
git config diff.foo.textconv "$PWD"/dump
|
git config diff.foo.textconv "\"$PWD\""/dump
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'rewrite diff respects textconv' '
|
test_expect_success 'rewrite diff respects textconv' '
|
||||||
|
Loading…
Reference in New Issue
Block a user