* [PATCH] archive-tar: report filter start error only once
@ 2022-10-29 10:06 René Scharfe
2022-10-29 18:02 ` Taylor Blau
0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2022-10-29 10:06 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Taylor Blau
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>
---
archive-tar.c | 1 +
t/t5000-tar-tree.sh | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/archive-tar.c b/archive-tar.c
index 3e4822b684..f8fad2946e 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -498,6 +498,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
strvec_push(&filter.args, cmd.buf);
filter.use_shell = 1;
filter.in = -1;
+ filter.silent_exec_failure = 1;
if (start_command(&filter) < 0)
die_errno(_("unable to start '%s' filter"), cmd.buf);
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index eaa0b22ece..d473048138 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -342,6 +342,13 @@ test_expect_success 'only enabled filters are available remotely' '
test_cmp_bin remote.bar config.bar
'
+test_expect_success 'invalid filter is reported only once' '
+ test_must_fail git -c tar.invalid.command= archive --format=invalid \
+ HEAD >out 2>err &&
+ test_must_be_empty out &&
+ test_line_count = 1 err
+'
+
test_expect_success 'git archive --format=tgz' '
git archive --format=tgz HEAD >j.tgz
'
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] archive-tar: report filter start error only once
2022-10-29 10:06 [PATCH] archive-tar: report filter start error only once René Scharfe
@ 2022-10-29 18:02 ` Taylor Blau
0 siblings, 0 replies; 2+ messages in thread
From: Taylor Blau @ 2022-10-29 18:02 UTC (permalink / raw)
To: René Scharfe; +Cc: git, Junio C Hamano, Taylor Blau
On Sat, Oct 29, 2022 at 12:06:06PM +0200, René Scharfe wrote:
> ---
> archive-tar.c | 1 +
> t/t5000-tar-tree.sh | 7 +++++++
> 2 files changed, 8 insertions(+)
Looks very reasonable. Will queue, thanks.
Thanks,
Taylor
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-29 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 10:06 [PATCH] archive-tar: report filter start error only once René Scharfe
2022-10-29 18:02 ` Taylor Blau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.