mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
The editor used will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order). That ensures that `git-changelog` and `git-authors` will use the same editor as `git-commit`, `git-merge` etc.
37 lines
550 B
Bash
Executable file
37 lines
550 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
LIST=false
|
|
FILE=""
|
|
EDITOR=$(git var GIT_EDITOR)
|
|
|
|
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
|