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 <dev+git@drbeat.li>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Beat Bolli 2024-03-15 20:46:18 +01:00 committed by Junio C Hamano
parent babf0b89b3
commit f70bc702e5

View file

@ -74,8 +74,7 @@ do
sort >uncovered_lines.txt sort >uncovered_lines.txt
comm -12 uncovered_lines.txt new_lines.txt | comm -12 uncovered_lines.txt new_lines.txt |
sed -e 's/$/\)/' | sed -e 's/$/\)/' -e 's/^/ /' >uncovered_new_lines.txt
sed -e 's/^/ /' >uncovered_new_lines.txt
grep -q '[^[:space:]]' <uncovered_new_lines.txt && grep -q '[^[:space:]]' <uncovered_new_lines.txt &&
echo $file >>coverage-data.txt && echo $file >>coverage-data.txt &&
@ -91,11 +90,7 @@ cat coverage-data.txt
echo "Commits introducing uncovered code:" echo "Commits introducing uncovered code:"
commit_list=$(cat coverage-data.txt | commit_list=$(awk '/^[0-9a-f]{7,}/ { print $1 }' coverage-data.txt | sort -u)
grep -E '^[0-9a-f]{7,} ' |
awk '{print $1;}' |
sort |
uniq)
( (
for commit in $commit_list for commit in $commit_list