Skip to content

Commit 41a457e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bac8037 commit 41a457e

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

diff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,6 +3771,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
37713771
*arg = NULL;
37723772

37733773
memset(&child, 0, sizeof(child));
3774+
child.use_shell = 1;
37743775
child.argv = argv;
37753776
child.out = -1;
37763777
if (start_command(&child) != 0 ||

t/t4030-diff-textconv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_expect_success 'file is considered binary by plumbing' '
4848

4949
test_expect_success 'setup textconv filters' '
5050
echo file diff=foo >.gitattributes &&
51-
git config diff.foo.textconv "$PWD"/hexdump &&
51+
git config diff.foo.textconv "\"$PWD\""/hexdump &&
5252
git config diff.fail.textconv false
5353
'
5454

t/t4031-diff-rewrite-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ chmod +x dump
5454

5555
test_expect_success 'setup textconv' '
5656
echo file diff=foo >.gitattributes &&
57-
git config diff.foo.textconv "$PWD"/dump
57+
git config diff.foo.textconv "\"$PWD\""/dump
5858
'
5959

6060
test_expect_success 'rewrite diff respects textconv' '

0 commit comments

Comments
 (0)