mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
36 lines
521 B
Bash
Executable file
36 lines
521 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
LIST=false
|
|
FILE=""
|
|
|
|
if test "$1" = "-l" || test "$1" = "--list"; then
|
|
LIST=true
|
|
else
|
|
FILE=$1
|
|
if test "$FILE" = ""; then
|
|
FILE=`ls | egrep 'authors|contributors' -i|head -n1`
|
|
if test "$FILE" = ""; then
|
|
FILE='AUTHORS'
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
#
|
|
# list authors sorted by number of commits (descending).
|
|
#
|
|
|
|
authors() {
|
|
git shortlog -sne | awk '{$1=""; sub(" ", ""); print}'
|
|
}
|
|
|
|
#
|
|
# authors.
|
|
#
|
|
|
|
if $LIST; then
|
|
echo "$(authors)"
|
|
else
|
|
authors >> $FILE
|
|
test -n "$EDITOR" && $EDITOR $FILE
|
|
fi
|