3 if [ ! -d $GIT_DIR ]; then
4 echo Not a git directory
1>&2
7 git-update-cache
-q --refresh -- "$@" ||
exit 1
9 if [ ! -r $GIT_DIR/HEAD
]; then
10 if [ -z "$(git-ls-files)" ]; then
11 echo Nothing to commit
1>&2
16 echo "# Initial commit"
18 git-ls-files |
sed 's/^/# New file: /'
23 if [ -f $GIT_DIR/MERGE_HEAD
]; then
25 echo "# It looks like your may be committing a MERGE."
26 echo "# If this is not correct, please remove the file"
27 echo "# $GIT_DIR/MERGE_HEAD"
28 echo "# and try again"
30 PARENTS
="-p HEAD -p MERGE_HEAD"
32 git-status-script
>> .editmsg
40 ${VISUAL:-${EDITOR:-vi}} .editmsg
41 grep -v '^#' < .editmsg | git-stripspace
> .cmitmsg
43 tree
=$
(git-write-tree
) &&
44 commit
=$
(cat .cmitmsg | git-commit-tree
$tree $PARENTS) &&
45 echo $commit > $GIT_DIR/HEAD
&&
46 rm -f -- $GIT_DIR/MERGE_HEAD
48 rm -f .cmitmsg .editmsg