Skip to content

Commit

Permalink
Make "git commit" clean up after itself
Browse files Browse the repository at this point in the history
Noted by Jeff.
  • Loading branch information
Linus Torvalds committed Jun 20, 2005
1 parent 55a716c commit 170241b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions git-commit-script
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 170241b

Please sign in to comment.