forked from eisop-plume-lib/plume-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-authors
executable file
·55 lines (50 loc) · 1.99 KB
/
git-authors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Outputs a list of authors of commits, for the git repository where this is run.
# The output contains one name per line, in alphabetical order by first name.
# Command-line arguments:
# --punctuation Add commas after names (except a period after the last one)
# Formatting of accented characters:
# --html Use HTML escape sequences for accented characters
# --latex Use LaTeX escape sequences for accented characters
# --texinfo Use Texinfo escape sequences for accented characters
while :; do
case $1 in
--punctuation)
punctuation=1
;;
--html)
html=1
;;
--latex)
latex=1
;;
--texinfo)
texinfo=1
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
# shellcheck disable=SC2091 # Result is "true" or "false", surround with $(...) to interpret it.
if $(git rev-parse --is-shallow-repository); then
# It would be more efficient to use --filter=tree:0, but that is legal only if extensions.partialClone is set.
git fetch --unshallow --quiet
fi
# shellcheck disable=SC2015 # sed won't fail.
git log | grep '^\(Author\| Co-authored-by\):' | \
sed -E 's/(Author| Co-authored-by): (.*)/\2/' | sed -E 's/(.*) <.*>/\1/' | \
LC_ALL=C sort -u | \
sed -f "$(dirname "$0")"/git-authors.sed | LC_ALL=C sort -u | \
( [ -n "${html+x}" ] && sed -e "s/á/\\á/" -e "s/é/\\é/" -e "s/ß/\\ß/" || cat ) | \
( [ -n "${latex+x}" ] && sed -e "s/á/\\\\'a/" -e "s/é/\\\\'e/" -e "s/ß/\\\\ss /" || cat ) | \
( [ -n "${texinfo+x}" ] && sed -e "s/á/@'a/" -e "s/é/@'e/" -e "s/ß/@ss /" || cat ) | \
( [ -n "${punctuation+x}" ] && sed -e 's/$/,/' -e '$ s/,$/./' || cat ) | \
cat