blob: 1abfa143ee8fdc3896b9f05b6cc503675d735d4b [file] [log] [blame]
Linus Torvaldsa3e870f2005-05-30 12:51:00 -07001#!/bin/sh
Linus Torvalds9c065312005-06-08 13:33:15 -07002: ${GIT_DIR=.git}
3PARENTS="HEAD"
4if [ -f $GIT_DIR/MERGE_HEAD ]; then
5 echo "#"
6 echo "# It looks like your may be committing a MERGE."
7 echo "# If this is not correct, please remove the file"
8 echo "# $GIT_DIR/MERGE_HEAD"
9 echo "# and try again"
10 echo "#"
11 PARENTS="HEAD -p MERGE_HEAD"
12fi > .editmsg
13git-status-script >> .editmsg
Linus Torvaldsa3e870f2005-05-30 12:51:00 -070014if [ "$?" != "0" ]
15then
16 cat .editmsg
17 exit 1
18fi
Junio C Hamano2036d842005-05-30 13:53:45 -070019${VISUAL:-${EDITOR:-vi}} .editmsg
Linus Torvaldsa3e870f2005-05-30 12:51:00 -070020grep -v '^#' < .editmsg | git-stripspace > .cmitmsg
21[ -s .cmitmsg ] || exit 1
22tree=$(git-write-tree) || exit 1
Linus Torvalds9c065312005-06-08 13:33:15 -070023commit=$(cat .cmitmsg | git-commit-tree $tree -p $PARENTS) || exit 1
Linus Torvalds7f1d1122005-06-08 13:44:32 -070024echo $commit > $GIT_DIR/HEAD
25rm -f -- $GIT_DIR/MERGE_HEAD