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 "$(realpath "$(dirname "$0")")/check_fixes" "$@"
16 declare -a author_missing committer_missing
20 if [ "$#" -eq 1 ]; then
31 if [ "$#" -gt 1 ]; then
36 printf 'Commit%s\n\n' "$s"
37 git log --no-walk --pretty='format: %h ("%s")' "$@"
38 printf '\n%s missing a Signed-off-by from %s %s%s.\n\n' \
39 "$is" "$its" "$t" "$s"
42 check_unexpected_files()
46 readarray files < <(git diff-tree -r --diff-filter=A --name-only --no-commit-id "$1" '*.rej' '*.orig')
47 if [ "${#files[@]}" -eq 0 ]; then
53 if [ "${#files[@]}" -gt 1 ]; then
59 git log --no-walk --pretty='format: %h ("%s")' "$1"
60 printf '\nadded %s unexpected file%s:\n\n' "$this" "$s"
61 printf ' %s\n' "${files[@]}"
65 ae=$(git log -1 --format='<%ae>%n<%aE>%n %an %n %aN ' "$c" | sort -u)
66 ce=$(git log -1 --format='<%ce>%n<%cE>%n %cn %n %cN ' "$c" | sort -u)
67 sob=$(git log -1 --format='%b' "$c" |
68 sed -En 's/^\s*Signed-off-by:?\s*/ /ip')
70 if ! grep -i -F -q "$ae" <<<"$sob"; then
71 author_missing+=("$c")
73 if ! grep -i -F -q "$ce" <<<"$sob"; then
74 committer_missing+=("$c")
77 check_unexpected_files "$c"
80 print_commits 'author' "${author_missing[@]}"
81 print_commits 'committer' "${committer_missing[@]}"