Add diffstat, written by Evil_Bob. Thanks! - various - Various utilities develo… | |
git clone git://bitreich.org/various/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinw… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit 08ba44c39d435ca04d7ef39d7f5d5a8b783dd883 | |
parent 1e985cb90d976f0f4e63cf51cb6d031cc53d304e | |
Author: Christoph Lohmann <[email protected]> | |
Date: Mon, 10 Jan 2022 18:33:02 +0100 | |
Add diffstat, written by Evil_Bob. Thanks! | |
Diffstat: | |
A diffstat | 19 +++++++++++++++++++ | |
1 file changed, 19 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/diffstat b/diffstat | |
@@ -0,0 +1,19 @@ | |
+#!/bin/sh | |
+# script to quickly check how much is changed in a patch. | |
+# Written and (c) by Evil_Bob on 2022-01-10. | |
+ | |
+LC_ALL=C awk ' | |
+$0 ~ /^(\+\+\+|\-\-\-) /{ | |
+ # likely a diff header for a file. | |
+ next; | |
+} | |
+length($0) { | |
+ c = substr($0, 1, 1); | |
+ if (c == "-") | |
+ del++; | |
+ else if (c == "+") | |
+ add++; | |
+} | |
+END { | |
+ printf("%d insertions(+), %d deletions(-)\n", add, del); | |
+}' |