1 # git diff | awk -f thisfile.awk
2
3 function checkcasediff() {
4 if (i == j) {
5 caseonly = 1
6 for( n = 0; n < j; n++ ) {
7 if (tolower(additions[n]) != tolower(deletions[n]))
8 caseonly = 0
9 }
10 if (caseonly == 1)
11 # Yaay, this hunk is relevant
12 print previoushunkline
13 }
14
15 # Ready to process next hunk
16 delete additions
17 delete deletions
18 i=0
19 j=0
20 }
21 /^@@/ {
22 if (previoushunkline == "") {
23 # Before first hunk. Store header and move on
24 previoushunkline = $0
25 next
26 }
27 checkcasediff()
28 previoushunkline = $0
29 }
30
31 /^+[^+]/ {
32 # Strip off + or -
33 additions[i++] = substr($0, 2)
34
35 }
36
37 /^-[^-]/ {
38 # Strip off + or -
39 deletions[j++] = substr($0, 2)
40 }
41
42 END {
43 # Last hunk
44 checkcasediff()
45 }