#/bin/sh # Usage: check-series [upstream-commit] # Checks each commit in a patch series (topic branch) by running the # script devel/check-commit. If check-commit fails (exits with # non-zero status), the user is left in the middle of a git rebase, and # can fix the commit, e.g. using git commit --amend, followed by # "git rebase --continue". If all else fails, "git rebase --abort" should # get you back to where you started. # # NOTE: this runs "make test" many times, so it can take a while. # trap cleanup EXIT cleanup () { if [ -n "$tmpdir" ]; then rm -rf $tmpdir fi } upstream=master if [ -n "$1" ]; then upstream="$1" fi # make sure we always run the most recent version of check-commit # in particular cope with it going away. tmpdir=$(mktemp -d) cp devel/check-commit $tmpdir GIT_SEQUENCE_EDITOR="perl -pi -e 's,^\s*([^#\s].*)$,\1\nexec $tmpdir/check-commit,'" git rebase -i $upstream