X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=check_commits;h=9011cb3c11d99db1af6c594d233f31f9b5adc786;hb=HEAD;hp=d383d7759e2c632f485f3a351f2efd837d3a852f;hpb=7813058cfb00be63352f7fedd479404c073705bc;p=next-scripts diff --git a/check_commits b/check_commits index d383d77..9011cb3 100755 --- a/check_commits +++ b/check_commits @@ -11,6 +11,8 @@ if [ -z "$commits" ]; then exit 0 fi +"$(realpath "$(dirname "$0")")/check_fixes" "$@" + declare -a author_missing committer_missing print_commits() @@ -37,6 +39,28 @@ print_commits() "$is" "$its" "$t" "$s" } +check_unexpected_files() +{ + local files + + readarray files < <(git diff-tree -r --diff-filter=A --name-only --no-commit-id "$1" '*.rej' '*.orig') + if [ "${#files[@]}" -eq 0 ]; then + return + fi + + s= + this='this' + if [ "${#files[@]}" -gt 1 ]; then + s='s' + this='these' + fi + + printf 'Commit\n\n' + git log --no-walk --pretty='format: %h ("%s")' "$1" + printf '\nadded %s unexpected file%s:\n\n' "$this" "$s" + printf ' %s\n' "${files[@]}" +} + for c in $commits; do ae=$(git log -1 --format='<%ae>%n<%aE>%n %an %n %aN ' "$c" | sort -u) ce=$(git log -1 --format='<%ce>%n<%cE>%n %cn %n %cN ' "$c" | sort -u) @@ -49,6 +73,8 @@ for c in $commits; do if ! grep -i -F -q "$ce" <<<"$sob"; then committer_missing+=("$c") fi + + check_unexpected_files "$c" done print_commits 'author' "${author_missing[@]}"