diff mbox series

[05/22] t/perf: avoid redundant use of cat

Message ID 20240305212533.12947-6-dev+git@drbeat.li (mailing list archive)
State Superseded
Headers show
Series avoid redundant pipelines | expand

Commit Message

Beat Bolli March 5, 2024, 9:25 p.m. UTC
Take care to redirect stdin, otherwise the output of wc would also contain
the file name.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 t/perf/repos/inflate-repo.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano March 5, 2024, 10:29 p.m. UTC | #1
"Beat Bolli" <bb@drbeat.li> writes:

> Take care to redirect stdin, otherwise the output of wc would also contain
> the file name.
>
> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
> ---
>  t/perf/repos/inflate-repo.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/perf/repos/inflate-repo.sh b/t/perf/repos/inflate-repo.sh
> index fcfc992b5b02..412e4b450b16 100755
> --- a/t/perf/repos/inflate-repo.sh
> +++ b/t/perf/repos/inflate-repo.sh
> @@ -33,7 +33,7 @@ do
>  done
>  
>  git ls-tree -r HEAD >GEN_src_list
> -nr_src_files=$(cat GEN_src_list | wc -l)
> +nr_src_files=$(wc -l <GEN_src_list)

Good thinking to explicitly redirect into the command.

>  
>  src_branch=$(git symbolic-ref --short HEAD)
diff mbox series

Patch

diff --git a/t/perf/repos/inflate-repo.sh b/t/perf/repos/inflate-repo.sh
index fcfc992b5b02..412e4b450b16 100755
--- a/t/perf/repos/inflate-repo.sh
+++ b/t/perf/repos/inflate-repo.sh
@@ -33,7 +33,7 @@  do
 done
 
 git ls-tree -r HEAD >GEN_src_list
-nr_src_files=$(cat GEN_src_list | wc -l)
+nr_src_files=$(wc -l <GEN_src_list)
 
 src_branch=$(git symbolic-ref --short HEAD)