#!/bin/sh test "$#" -gt 0 || { echo "Usage: $0 "; exit 1; } combined=t while test "$#" -gt 0 do case "$1" in -c|--combined) combined=t ;; -i|--individual) combined= ;; --) shift break ;; *) break ;; esac shift done sort_enumerate () { sed -e 's/[^(]*(\([^0-9]*\).*/\1/' -e 's/[\t ]*$//' \ | sort | uniq -c | sort -nr } show_owners () { for f in "$@"; do test -d "$f" && { show_owners "$f"/*; continue; } git blame -C -C -M "$f" done } if test "$combined" = t; then echo "$@" show_owners "$@" | sort_enumerate else echo "Showing one-at-a-time ownership" for f in "$@"; do echo "$f" show_owners "$f" | sort_enumerate done fi