2 # Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
5 # SPDX-License-Identifier: LGPL-2.1-or-later
10 $0 [-h|--help] [-e|--include-email] [-|--stdin] [LAST_COMMIT [FIRST_COMMIT|--initial]]"
12 Prints list of contributors for the specified range of commits.
15 -h, --help Print this message and exit.
17 Include e-mail address of each contributer in the output.
18 -, --stdin Read the list of additional contributors from stdin.
19 LAST_COMMIT Last commit of the range. Default value is HEAD.
20 FIRST_COMMIT First commit in the range. Default is the last commit tagged
21 with a tag started with the character 'v'. If "--initial"
22 is specified, the first commit of the branch is used.
28 git rev-parse --verify "$1^{commit}"
31 SCRIPT='s/^[^:@<]\+:[[:space:]]*"\?\([^"<@[:space:]][^"<@]*\)"\?[[:space:]]\(<[^<@]\+@[^>]\+>\).*/\1 \2/p'
32 # Script for adding angle brackets to e-mail addresses in case they are absent
33 SCRIPT_NORM_EMAILS='s/[^[:space:]<@]\+@[^>]\+$/<\0>/'
34 MATCH_OUT='^\([^<@[:space:]][^<@]*\)[[:space:]]\(<[^<@]\+@[^>]\+>\)$'
61 what="$(get_commit_id "${1:-@}")"
62 since="${2:-$(git describe --abbrev=0 --match='v*' "$what")}"
66 since="$(git rev-list --max-parents=0 $what)"
69 since="$(get_commit_id "$since")"
73 if [ 0 = "$include_email" ]; then
80 git log "^$since" "$what" | sed -n "$SCRIPT"
81 [ 0 = "$read_stdin" ] || sed "$SCRIPT_NORM_EMAILS"
83 | git check-mailmap --stdin \
84 | LC_COLLATE=C sort -u \
85 | sed "s/$MATCH_OUT/$out/"