diff mbox series

[22/22] git-quiltimport: avoid an unnecessary subshell

Message ID 20240305212533.12947-23-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
Use braces for the compound command.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
---
 git-quiltimport.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rubén Justo March 5, 2024, 10:55 p.m. UTC | #1
On Tue, Mar 05, 2024 at 10:25:20PM +0100, Beat Bolli wrote:
> Merge multiple sed and "grep | awk" invocations, finally use "sort -u"
> instead of "sort | uniq".
> 
> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
> ---
>  contrib/coverage-diff.sh | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/contrib/coverage-diff.sh b/contrib/coverage-diff.sh
> index 4ec419f90048..6ce9603568ef 100755
> --- a/contrib/coverage-diff.sh
> +++ b/contrib/coverage-diff.sh
> @@ -74,8 +74,7 @@ do
>  	sort >uncovered_lines.txt
>  
>  	comm -12 uncovered_lines.txt new_lines.txt |
> -	sed -e 's/$/\)/' |
> -	sed -e 's/^/ /' >uncovered_new_lines.txt
> +	sed -e 's/$/\)/' -e 's/^/ /' >uncovered_new_lines.txt
>  
>  	grep -q '[^[:space:]]' <uncovered_new_lines.txt &&
>  	echo $file >>coverage-data.txt &&
> @@ -91,11 +90,7 @@ cat coverage-data.txt
>  
>  echo "Commits introducing uncovered code:"
>  
> -commit_list=$(cat coverage-data.txt |
> -	grep -E '^[0-9a-f]{7,} ' |
> -	awk '{print $1;}' |
> -	sort |
> -	uniq)
> +commit_list=$(awk '/^[0-9a-f]{7,}/ { print $1 }' coverage-data.txt | sort -u)

OK.  Not worth a re-roll of course, but perhaps some wrapping would be
welcomed here.

>  
>  (
>  	for commit in $commit_list
> -- 
> 2.44.0
>
diff mbox series

Patch

diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index e3d390974331..eb34cda4092a 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -148,7 +148,7 @@  do
 	if [ -z "$dry_run" ] ; then
 		git apply --index -C1 ${level:+"$level"} "$tmp_patch" &&
 		tree=$(git write-tree) &&
-		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
+		commit=$( { echo "$SUBJECT"; echo; cat "$tmp_msg"; } | git commit-tree $tree -p $commit) &&
 		git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
 	fi
 done 3<"$QUILT_SERIES"