From 2fbd3ac8e6786a12a15e1c1f396789651ad52f06 Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Fri, 15 Mar 2024 20:45:59 +0100 Subject: contrib/subtree/t: avoid redundant use of cat Signed-off-by: Beat Bolli Acked-by: Taylor Blau Signed-off-by: Junio C Hamano --- contrib/subtree/t/t7900-subtree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh index ca4df5be83..c3bd2a58b9 100755 --- a/contrib/subtree/t/t7900-subtree.sh +++ b/contrib/subtree/t/t7900-subtree.sh @@ -63,7 +63,7 @@ test_create_pre2_32_repo () { git -C "$1" log -1 --format=%B HEAD^2 >msg && test_commit -C "$1-sub" --annotate sub2 && git clone --no-local "$1" "$1-clone" && - new_commit=$(cat msg | sed -e "s/$commit/$tag/" | git -C "$1-clone" commit-tree HEAD^2^{tree}) && + new_commit=$(sed -e "s/$commit/$tag/" msg | git -C "$1-clone" commit-tree HEAD^2^{tree}) && git -C "$1-clone" replace HEAD^2 $new_commit } -- cgit v1.3 From f70bc702e52796933cafa30dde54fe3c07aa2e81 Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Fri, 15 Mar 2024 20:46:18 +0100 Subject: contrib/coverage-diff: avoid redundant pipelines Merge multiple sed and "grep | awk" invocations, finally use "sort -u" instead of "sort | uniq". Signed-off-by: Beat Bolli Acked-by: Taylor Blau Signed-off-by: Junio C Hamano --- contrib/coverage-diff.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'contrib') diff --git a/contrib/coverage-diff.sh b/contrib/coverage-diff.sh index 4ec419f900..6ce9603568 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:]]' >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) ( for commit in $commit_list -- cgit v1.3