#!/bin/sh
# ensure that vc-dwim inserts a blank line when necessary

. "${srcdir=.}/init.sh"; path_prepend_ ..
print_ver_ vc-dwim

require_git_

cat <<EOF > ChangeLog || framework_failure_
2006-09-04  Jim Meyering  <jim@meyering.net>
EOF
git init > /dev/null 2>&1		\
  && git add .				\
  && git commit -m m . > /dev/null 2>&1	\
    || framework_failure_

touch x || framework_failure_
git add x || framework_failure_
cat <<EOF >> ChangeLog || framework_failure_

	Summary
	* x: body
EOF
cat <<EOF >> exp || framework_failure_
    Summary

    * x: body
EOF

set -e
fail=0

vc-dwim --commit > /dev/null
git log -1 > out.t
tail -n3 out.t |sed 's/^    $//' > out
diff -u out exp || fail=1
Exit 0
