3 if [ ! -d $GIT_DIR ]; then
4 echo Not a git directory 1>&2
8 if [ ! -r $GIT_DIR/HEAD ]; then
9 if [ -z "$(git-ls-files)" ]; then
10 echo Nothing to commit 1>&2
15 echo "# Initial commit"
17 git-ls-files | sed 's/^/# New file: /'
22 if [ -f $GIT_DIR/MERGE_HEAD ]; then
24 echo "# It looks like your may be committing a MERGE."
25 echo "# If this is not correct, please remove the file"
26 echo "# $GIT_DIR/MERGE_HEAD"
27 echo "# and try again"
29 PARENTS="-p HEAD -p MERGE_HEAD"
31 git-status-script >> .editmsg
38 ${VISUAL:-${EDITOR:-vi}} .editmsg
39 grep -v '^#' < .editmsg | git-stripspace > .cmitmsg
40 [ -s .cmitmsg ] || exit 1
41 tree=$(git-write-tree) || exit 1
42 commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) || exit 1
43 echo $commit > $GIT_DIR/HEAD
44 rm -f -- $GIT_DIR/MERGE_HEAD