#!/bin/sh
# Demonstrate that the code accepts another flavor of ChangeLog entry.

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

require_git_

touch f ChangeLog || framework_failure_
git init > /dev/null || framework_failure_
git add . || framework_failure_
git commit -m m . > /dev/null || framework_failure_

fail=0

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

	Import this patch from libc:

	2006-04-07  Someone Else  <foo@bar.com>

	* f: whatever
EOF
echo bow > f || fail=1

vc-dwim ChangeLog > out || fail=1

cat <<\EOF > exp || fail=1
Import this patch from libc:

2006-04-07  Someone Else  <foo@bar.com>

* f: whatever
diff --git a/f b/f
index e69de29..de03f25 100644
--- a/f
+++ b/f
@@ -0,0 +1 @@
+bow
EOF

cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null

Exit $fail
