Skip to content

Commit f70bc70

Browse files
Beat Bolligitster
Beat Bolli
authored andcommitted
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 <[email protected]> Acked-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent babf0b8 commit f70bc70

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

contrib/coverage-diff.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ do
7474
sort >uncovered_lines.txt
7575

7676
comm -12 uncovered_lines.txt new_lines.txt |
77-
sed -e 's/$/\)/' |
78-
sed -e 's/^/ /' >uncovered_new_lines.txt
77+
sed -e 's/$/\)/' -e 's/^/ /' >uncovered_new_lines.txt
7978

8079
grep -q '[^[:space:]]' <uncovered_new_lines.txt &&
8180
echo $file >>coverage-data.txt &&
@@ -91,11 +90,7 @@ cat coverage-data.txt
9190

9291
echo "Commits introducing uncovered code:"
9392

94-
commit_list=$(cat coverage-data.txt |
95-
grep -E '^[0-9a-f]{7,} ' |
96-
awk '{print $1;}' |
97-
sort |
98-
uniq)
93+
commit_list=$(awk '/^[0-9a-f]{7,}/ { print $1 }' coverage-data.txt | sort -u)
9994

10095
(
10196
for commit in $commit_list

0 commit comments

Comments
 (0)