3 0f4372e2 2022-10-03 op Show diff statistics.
5 0f4372e2 2022-10-03 op #!/usr/bin/awk -f
7 0f4372e2 2022-10-03 op maybe not 100% correct, but it's one case where being simple yet
8 0f4372e2 2022-10-03 op slightly wrong is way easier than correct. It's not a catastrophe to
9 0f4372e2 2022-10-03 op count some extra lines, while parsing the diff (possibly enclosed in a
10 0f4372e2 2022-10-03 op mail) is hard.
15 0f4372e2 2022-10-03 op Don't be a sink! Continue the pipeline so we can further save or apply
18 0f4372e2 2022-10-03 op // { print $0 }
20 0f4372e2 2022-10-03 op At the end, print the stats to standard error to avoid mangling the
21 0f4372e2 2022-10-03 op input. Unfortunately, there doesn't seem to be a "built-in" way of
22 0f4372e2 2022-10-03 op printing to stderr other than using the pseudo-device.
25 0f4372e2 2022-10-03 op print "+", a > "/dev/stderr"
26 0f4372e2 2022-10-03 op print "-", m > "/dev/stderr"
29 0f4372e2 2022-10-03 op some example usages:
31 0f4372e2 2022-10-03 op * cvs -q di | diffstat | tee /tmp/diff | less
32 0f4372e2 2022-10-03 op * git diff | diffstat > /tmp/diff
33 0f4372e2 2022-10-03 op * got di | diffstat | ssh foo 'cd xyz && got patch'