Handle globbing master
authorJacob Casper <dev@jacobcasper.com>
Thu, 19 Mar 2020 18:55:57 +0000 (13:55 -0500)
committerJacob Casper <dev@jacobcasper.com>
Thu, 19 Mar 2020 19:12:44 +0000 (14:12 -0500)
README.md
blame.sh

index 9b190a9..52a011c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ A shell script to see who should _really_ own a file in your `git` project.
 
 ## Usage
 
-`blame [file]`
+`blame [file ...]`
 
 ## Installation
 
index 6c32e2e..93d7375 100755 (executable)
--- a/blame.sh
+++ b/blame.sh
@@ -1,2 +1,5 @@
 #!/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}'
+for FILE in "$@"; do
+  echo $FILE
+  git blame --line-porcelain -- $FILE | 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}'
+done