Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Make "git commit" clean up after itself
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Mon, 20 Jun 2005 02:57:01 +0000
(19:57 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Mon, 20 Jun 2005 02:57:01 +0000
(19:57 -0700)
Noted by Jeff.
git-commit-script
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
55a716c
)
diff --git
a/git-commit-script
b/git-commit-script
index f88a51a43ce2a3660fa82c13e502df429678d168..5e5c0ccb3a8605248e1467a6841a03ef65540eb0 100755
(executable)
--- a/
git-commit-script
+++ b/
git-commit-script
@@
-33,12
+33,16
@@
fi
if [ "$?" != "0" ]
then
cat .editmsg
if [ "$?" != "0" ]
then
cat .editmsg
+ rm .editmsg
exit 1
fi
${VISUAL:-${EDITOR:-vi}} .editmsg
grep -v '^#' < .editmsg | git-stripspace > .cmitmsg
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"