#!/bin/bash -e
if [[ -f .zit/$(symbolic-ref HEAD) ]]; then # for non-initial commit
parents='-p HEAD'
fi
echo '# write a commit message' > .zit/COMMIT_EDITMSG
${EDITOR-vi} .zit/COMMIT_EDITMSG
tree=$(write-tree)
commit=$(grep -v '^#' .zit/COMMIT_EDITMSG | commit-tree $tree $parents)
update-ref HEAD $commit
rm -f .zit/COMMIT_EDITMSG