archive-tar: report filter start error only once
A missing tar filter is reported by start_command() using error(), but also by its caller, write_tar_filter_archive(), using die(): $ git -c tar.invalid.command=foo archive --format=invalid HEAD error: cannot run foo: No such file or directory fatal: unable to start 'foo' filter: No such file or directory The second message contains all relevant information and even says that the failed command was intended to be used as a filter. Silence the first one because it's redundant. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Taylor Blau <me@ttaylorr.com>
René Scharfe committed
Oct 29, 2022 at 12:06 UTC
1e4ea950f7a83240e15f5e77369cf700b94e8759
2 files changed
+8
archive-tar.c
+1
@@ -498,6 +498,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
498
strvec_push(&filter.args, cmd.buf);
499
filter.use_shell = 1;
500
filter.in = -1;
501
+ filter.silent_exec_failure = 1;
502
503
if (start_command(&filter) < 0)
504
die_errno(_("unable to start '%s' filter"), cmd.buf);
t/t5000-tar-tree.sh
+7
@@ -342,6 +342,13 @@ test_expect_success 'only enabled filters are available remotely' '
342
test_cmp_bin remote.bar config.bar
343
'
344
345
+test_expect_success 'invalid filter is reported only once' '
346
+ test_must_fail git -c tar.invalid.command= archive --format=invalid \
347
+ HEAD >out 2>err &&
348
+ test_must_be_empty out &&
349
+ test_line_count = 1 err
350
+'
351
+
352
test_expect_success 'git archive --format=tgz' '
353
git archive --format=tgz HEAD >j.tgz
354
'