From: Linus Torvalds Date: Mon, 20 Jun 2005 02:57:01 +0000 (-0700) Subject: Make "git commit" clean up after itself X-Git-Tag: v0.99~244 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=170241b7d1437e082c13a6f6b812eb827a7d48e0;p=git.git Make "git commit" clean up after itself Noted by Jeff. --- diff --git a/git-commit-script b/git-commit-script index f88a51a43..5e5c0ccb3 100755 --- a/git-commit-script +++ b/git-commit-script @@ -33,12 +33,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"