@matheusbsbs / matheus-bagliano / commits / 41a457e4f8
Fork 0

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>

Jeff King committed Dec 30, 2009 at 06:01 UTC 41a457e4f814a0e514548b3178e7692129f0fcfe
3 files changed +3 -2
diff.c
+1
@@ -3771,6 +3771,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
3771 *arg = NULL;
3772
3773 memset(&child, 0, sizeof(child));
3774 + child.use_shell = 1;
3775 child.argv = argv;
3776 child.out = -1;
3777 if (start_command(&child) != 0 ||
t/t4030-diff-textconv.sh
+1 -1
@@ -48,7 +48,7 @@ test_expect_success 'file is considered binary by plumbing' '
48
49 test_expect_success 'setup textconv filters' '
50 echo file diff=foo >.gitattributes &&
51 - git config diff.foo.textconv "$PWD"/hexdump &&
51 + git config diff.foo.textconv "\"$PWD\""/hexdump &&
52 git config diff.fail.textconv false
53 '
54
t/t4031-diff-rewrite-binary.sh
+1 -1
@@ -54,7 +54,7 @@ chmod +x dump
54
55 test_expect_success 'setup textconv' '
56 echo file diff=foo >.gitattributes &&
57 - git config diff.foo.textconv "$PWD"/dump
57 + git config diff.foo.textconv "\"$PWD\""/dump
58 '
59
60 test_expect_success 'rewrite diff respects textconv' '