#!/bin/bash ldir=/home/cmaiolino/Source/tools/maintainer source $ldir/djwong-git # Run the checkpatch script on every commit in the list. if [ "$#" -gt 1 ] || [ "$1" = "--help" ]; then echo "Usage: $0 " 1>&2 exit 1 fi commit_range="$(commit_range_from_arg "$1")" || exit 1 readarray -t commits < <(git rev-list --reverse --no-merges "${commit_range}") if [ "${#commits[@]}" -eq 0 ]; then echo 'No commits?' exit 1 fi debug=1 test -n "${DBG}" && debug=1 bad=0 for commit_id in "${commits[@]}"; do range="${commit_id}^1..${commit_id}" oneline="$(git log --oneline "${range}")" # Dump commit in full format so we get committer git log --format=full "${range}" | \ awk -f "$ldir/checkpatch.awk" \ -v "commit_id=${commit_id}" \ -v "debug=${debug}" \ -v "oneline=${oneline}" test $? -eq 0 || bad=1 done test "${bad}" -eq 0