#!/bin/bash set -e SUBDIRECTORY_OK=Yes . git-sh-setup require_work_tree cd_to_toplevel TMPB=`mktemp -t git-commit-cp.XXXXXX` || exit 1 ORIGINAL="$TMPB-original" TOAPPLY="$TMPB-apply" TOSKIP="$TMPB-skip" function cleanup() { rm $TMPB $ORIGINAL $TOAPPLY $TOSKIP } git-diff --full-index HEAD > $ORIGINAL git-pcp $ORIGINAL $TOAPPLY $TOSKIP if [ ! -s $TOAPPLY ]; then echo "* Nothing to commit!" cleanup exit 1 fi if [ -s $TOSKIP ]; then git-apply -R $TOSKIP; fi git-commit -a "$@" if [ -s $TOSKIP ]; then git-apply --index $TOSKIP; fi cleanup exit 0