Debian Codegraph @

doc/collect-authors.sh

raw
1 #!/bin/sh
2
3 if [ $# -ne 3 ]
4 then
5 echo "Wrong number of arguments. Usage: $0 [authors|reviewers] outfile git_dir" >&2
6 exit 1
7 fi
8
9 case "$1" in
10 authors)
11 GROUP_ARGS="--group=author --group=trailer:Co-Authored-by --group=trailer:Co-Developed-by"
12 ;;
13 reviewers)
14 GROUP_ARGS="--group=trailer:Reviewed-by"
15 ;;
16 *)
17 echo "Unknown contributor kind: \"$1\"" >&2
18 exit 1
19 ;;
20 esac
21 OUTFILE="$2"
22 # GIT_DIR is passed explicitly so we never need to guess where
23 # the source directory is. It may be somewhere entirely different
24 # from where meson is running us.
25 GIT_DIR="$3"
26
27 if ! command -v git >/dev/null
28 then
29 echo "git not available" >&2
30 exit 1
31 fi
32
33 if [ ! -d "$GIT_DIR" ]
34 then
35 echo "GIT_DIR ($GIT_DIR) does not exist" >&2
36 exit 1
37 fi
38
39 git --no-pager --git-dir="$GIT_DIR" shortlog --summary --numbered $GROUP_ARGS HEAD > "$OUTFILE"