From 237c6423e112d1ab06ca9aa783018094fc536d48 Mon Sep 17 00:00:00 2001 From: Jacob Casper Date: Thu, 19 Mar 2020 13:54:16 -0500 Subject: [PATCH] Initial commit --- Makefile | 4 ++++ README.md | 7 +++++++ blame.sh | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100755 blame.sh diff --git a/Makefile b/Makefile new file mode 100644 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 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 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}' -- 2.20.1