#!/bin/sh
# This runs git-dch with appropriate options.
#
# All given options are handed over to git-dch without tampering. You
# should probably give a --since="..." definition, so the program knows
# were to start. Also, when you're planning on a release, pass `-R'. For
# snapshots, use `-S'.
#
# This script also takes care of weeding out [dch-ignore] lines from the
# generated changelog.
#
# At the end an editor is spawned on debian/changelog no matter what.

git-dch \
    --spawn-editor=never \
    "$@"

old="debian/changelog.old"
cl="debian/changelog"

rm -f "$old"
cp "$cl" "$old"
sed -e '/^  \* \[[a-f0-9]*\] \[dch-ignored?\] /d' < "$old" > "$cl"
rm -f "$old"

${VISUAL:-${EDITOR:-vi}} "$cl"
