{"thread":{"id":"58715","subject":"[PATCH] archive-tar: report filter start error only once","startedAt":"2022-10-29T10:06:22Z","lastAt":"2022-10-29T18:02:34Z","messageCount":2,"participants":["René Scharfe","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"466010","messageId":"c51b72e5-1c32-65e4-6faa-04693b623e2e@web.de","threadId":"58715","inReplyTo":null,"subject":"[PATCH] archive-tar: report filter start error only once","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2022-10-29T10:06:06Z","receivedAt":"2022-10-29T10:06:22Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"A missing tar filter is reported by start_command() using error(), but\nalso by its caller, write_tar_filter_archive(), using die():\n\n   $ git -c tar.invalid.command=foo archive --format=invalid HEAD\n   error: cannot run foo: No such file or directory\n   fatal: unable to start 'foo' filter: No such file or directory\n\nThe second message contains all relevant information and even says that\nthe failed command was intended to be used as a filter.  Silence the\nfirst one because it's redundant.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n archive-tar.c       | 1 +\n t/t5000-tar-tree.sh | 7 +++++++\n 2 files changed, 8 insertions(+)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 3e4822b684..f8fad2946e 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -498,6 +498,7 @@ static int write_tar_filter_archive(const struct archiver *ar,\n \tstrvec_push(&filter.args, cmd.buf);\n \tfilter.use_shell = 1;\n \tfilter.in = -1;\n+\tfilter.silent_exec_failure = 1;\n\n \tif (start_command(&filter) < 0)\n \t\tdie_errno(_(\"unable to start '%s' filter\"), cmd.buf);\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex eaa0b22ece..d473048138 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -342,6 +342,13 @@ test_expect_success 'only enabled filters are available remotely' '\n \ttest_cmp_bin remote.bar config.bar\n '\n\n+test_expect_success 'invalid filter is reported only once' '\n+\ttest_must_fail git -c tar.invalid.command= archive --format=invalid \\\n+\t\tHEAD >out 2>err &&\n+\ttest_must_be_empty out &&\n+\ttest_line_count = 1 err\n+'\n+\n test_expect_success 'git archive --format=tgz' '\n \tgit archive --format=tgz HEAD >j.tgz\n '\n--\n2.30.2\n"},{"id":"466027","messageId":"Y11qsz+xvm6TVYrh@nand.local","threadId":"58715","inReplyTo":"c51b72e5-1c32-65e4-6faa-04693b623e2e@web.de","subject":"Re: [PATCH] archive-tar: report filter start error only once","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2022-10-29T18:02:27Z","receivedAt":"2022-10-29T18:02:34Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Sat, Oct 29, 2022 at 12:06:06PM +0200, René Scharfe wrote:\n> ---\n>  archive-tar.c       | 1 +\n>  t/t5000-tar-tree.sh | 7 +++++++\n>  2 files changed, 8 insertions(+)\n\nLooks very reasonable. Will queue, thanks.\n\nThanks,\nTaylor\n"}]}