3 if [ "$#" -lt 1 ]; then
4 printf 'Usage: %s <commit range>\n' "$0" 1>&2
8 commits=$(git rev-list --no-merges "$@")
9 if [ -z "$commits" ]; then
14 declare -a author_missing committer_missing
18 if [ "$#" -eq 1 ]; then
29 if [ "$#" -gt 1 ]; then
34 printf 'Commit%s\n\n' "$s"
35 git log --no-walk --pretty='format: %h ("%s")' "$@"
36 printf '\n%s missing a Signed-off-by from %s %s%s.\n\n' \
37 "$is" "$its" "$t" "$s"
40 check_unexpected_files()
44 readarray files < <(git diff-tree -r --diff-filter=A --name-only --no-commit-id "$1" '*.rej' '*.orig')
45 if [ "${#files[@]}" -eq 0 ]; then
51 if [ "${#files[@]}" -gt 1 ]; then
57 git log --no-walk --pretty='format: %h ("%s")' "$1"
58 printf '\nadded %s unexpected file%s:\n\n' "$this" "$s"
59 printf ' %s\n' "${files[@]}"
63 ae=$(git log -1 --format='<%ae>%n<%aE>%n %an %n %aN ' "$c" | sort -u)
64 ce=$(git log -1 --format='<%ce>%n<%cE>%n %cn %n %cN ' "$c" | sort -u)
65 sob=$(git log -1 --format='%b' "$c" |
66 sed -En 's/^\s*Signed-off-by:?\s*/ /ip')
68 if ! grep -i -F -q "$ae" <<<"$sob"; then
69 author_missing+=("$c")
71 if ! grep -i -F -q "$ce" <<<"$sob"; then
72 committer_missing+=("$c")
75 check_unexpected_files "$c"
78 print_commits 'author' "${author_missing[@]}"
79 print_commits 'committer' "${committer_missing[@]}"