X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=git-commit-script;h=57f5333db8517f4f250b563f694c067446c78c10;hb=180926636e47ecfe28d03cec493af75899994f0f;hp=f88a51a43ce2a3660fa82c13e502df429678d168;hpb=96069cf03aca672e93d862813f2e7f05c1c7ac72;p=git.git diff --git a/git-commit-script b/git-commit-script index f88a51a4..57f5333d 100755 --- a/git-commit-script +++ b/git-commit-script @@ -4,6 +4,7 @@ if [ ! -d $GIT_DIR ]; then echo Not a git directory 1>&2 exit 1 fi +git-update-cache -q --refresh -- "$@" || exit 1 PARENTS="-p HEAD" if [ ! -r $GIT_DIR/HEAD ]; then if [ -z "$(git-ls-files)" ]; then @@ -33,12 +34,16 @@ fi if [ "$?" != "0" ] then cat .editmsg + rm .editmsg exit 1 fi ${VISUAL:-${EDITOR:-vi}} .editmsg grep -v '^#' < .editmsg | git-stripspace > .cmitmsg -[ -s .cmitmsg ] || exit 1 -tree=$(git-write-tree) || exit 1 -commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) || exit 1 -echo $commit > $GIT_DIR/HEAD -rm -f -- $GIT_DIR/MERGE_HEAD +[ -s .cmitmsg ] && + tree=$(git-write-tree) && + commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) && + echo $commit > $GIT_DIR/HEAD && + rm -f -- $GIT_DIR/MERGE_HEAD +ret="$?" +rm -f .cmitmsg .editmsg +exit "$ret"