#!/bin/sh
# Check for when there's a one-line ChangeLog entry but no diffs
# to the named file.

if test "$VERBOSE" = yes; then
  set -x
  vc-dwim --version
fi

. $srcdir/trap-setup

require_git_

framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1

cat <<EOF > ChangeLog || framework_failure=1
2006-09-04  Jim Meyering  <jim@meyering.net>

	* foo: bar.

EOF
git init > /dev/null || framework_failure=1
git add . || framework_failure=1
git commit -m m . > /dev/null || framework_failure=1

if test $framework_failure = 1; then
  echo "$0: failure in testing framework" 1>&2
  (exit 1); exit 1
fi

set -e

cat <<EOF > ChangeLog
2006-09-04  Jim Meyering  <jim@meyering.net>

	* not-mod: x
	* foo: bar.

EOF

vc-dwim ChangeLog > out 2>&1 && false

cat <<\EOF > exp
vc-dwim: not-mod is listed in the ChangeLog entry, but not in diffs.
Did you forget to add it?
EOF

cmp out exp \
  || { diff out exp 2> /dev/null; false; }

Exit 0
