API: Use string type instead of u8.
[vpp.git] / extras / scripts / coverity-blame
1 #!/bin/sh
2
3 # Read coverity email on stdin
4 # whenever we find a filename & line number reference, go git-blame it
5
6 file=
7 start=
8 end=
9
10 while read line; do
11         if echo "$line" | grep -q '^/.*: '; then
12                 echo "$line"
13                 file=$(echo "$line" | cut -d: -f1)
14         elif echo "$line" | grep -q '^[*]'; then
15                 echo "$line"
16                 file=
17                 start=
18                 end=
19         elif echo "$line" | grep -q '^[0-9][0-9]*'; then
20                 num=$(echo "$line" | awk '{print $1}')
21                 [ -z "$start" ] && start=$num
22                 #git blame -L "$num,+1" ".$file" | cat
23         elif [ -z "$line" ]; then
24                 if [ "$start" -a "$num" -a "$file" ]; then
25                         end=$num
26                         git blame --date=short -L "$start,$end" ".$file" | cat
27                         start=
28                         end=
29                         num=
30                 else
31                         echo "$line"
32                 fi
33         else
34                 echo "$line"
35         fi
36 done