#!/bin/sh

git diff origin/master -- doc/news/_preparation_next_release.md | egrep "^\+.+_\(.+\)_"
if [ $? != "0" ]; then
	linesChanged=$(git diff --numstat origin/master -- doc/news/_preparation_next_release.md | cut -f1)
	if [ -n "$linesChanged" ] && [ "$linesChanged" -ge "5" ]; then
		echo "We assume that you know what you are doing."
		exit 0
	fi
	echo "The release notes were not extended correctly (with $linesChanged lines changed)."
	echo "Please make sure you add at least one line describing your contribution followed"
	echo "by the text _(your name)_."
	echo ""
	echo "For example, if Sandra Power fixed a typo, she adds to doc/news/_preparation_next_release.md:"
	echo "- typo fixed _(Sandra Power)_"
	echo ""
	echo "Similar contributions might be summarized shortly before the release."
	exit 1
fi
