Linus Torvalds | a3e870f | 2005-05-30 12:51:00 -0700 | [diff] [blame] | 1 | #!/bin/sh |
Linus Torvalds | 9c06531 | 2005-06-08 13:33:15 -0700 | [diff] [blame] | 2 | : ${GIT_DIR=.git} |
| 3 | PARENTS="HEAD" |
| 4 | if [ -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" |
| 12 | fi > .editmsg |
| 13 | git-status-script >> .editmsg |
Linus Torvalds | a3e870f | 2005-05-30 12:51:00 -0700 | [diff] [blame] | 14 | if [ "$?" != "0" ] |
| 15 | then |
| 16 | cat .editmsg |
| 17 | exit 1 |
| 18 | fi |
Junio C Hamano | 2036d84 | 2005-05-30 13:53:45 -0700 | [diff] [blame] | 19 | ${VISUAL:-${EDITOR:-vi}} .editmsg |
Linus Torvalds | a3e870f | 2005-05-30 12:51:00 -0700 | [diff] [blame] | 20 | grep -v '^#' < .editmsg | git-stripspace > .cmitmsg |
| 21 | [ -s .cmitmsg ] || exit 1 |
| 22 | tree=$(git-write-tree) || exit 1 |
Linus Torvalds | 9c06531 | 2005-06-08 13:33:15 -0700 | [diff] [blame] | 23 | commit=$(cat .cmitmsg | git-commit-tree $tree -p $PARENTS) || exit 1 |
Linus Torvalds | 7f1d112 | 2005-06-08 13:44:32 -0700 | [diff] [blame] | 24 | echo $commit > $GIT_DIR/HEAD |
| 25 | rm -f -- $GIT_DIR/MERGE_HEAD |