Initial commit
authorJacob Casper <dev@jacobcasper.com>
Thu, 19 Mar 2020 18:54:16 +0000 (13:54 -0500)
committerJacob Casper <dev@jacobcasper.com>
Thu, 19 Mar 2020 18:54:16 +0000 (13:54 -0500)
Makefile [new file with mode: 0644]
README.md [new file with mode: 0644]
blame.sh [new file with mode: 0755]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..d62189f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+install:
+       ln -fF blame.sh /usr/local/bin/blame
+uninstall:
+       rm -f /usr/local/bin/blame
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..9a394a1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# Blame
+
+A shell script to see who should _really_ own a file in your `git` project.
+
+## Usage
+
+`blame [file]`
diff --git a/blame.sh b/blame.sh
new file mode 100755 (executable)
index 0000000..6c32e2e
--- /dev/null
+++ b/blame.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+git blame --line-porcelain -- $1 | awk '/^author /' | awk '{$1 = ""; author=substr($0, 2); counts[author] += 1} END { for (author in counts) {print counts[author],author,counts[author],counts[author]/NR*100"%"} }' | sort -nr -k 1 | awk '{$1 = ""; print $0}'