-echo "Excluding files which change version (configure.in, SConstruct)"
-filterdiff -x 'configure.in' lighttpd-branch.diff > lighttpd-branch.diff.tmp
-mv -f lighttpd-branch.diff.tmp lighttpd-branch.diff
+d=$-
+filter() {
+ set -$d
+ # Excluding files which change version or were not in dist tarball
+ filterdiff -p1 \
+ -x '.gitignore' \
+ -x 'CMakeLists.txt' \
+ -x 'SConstruct' \
+ -x 'configure.ac' \
+ -x 'packdist.sh' \
+ | cat
+}
+
+if [ ! -d $repo ]; then
+ git clone --bare $url -b $branch $repo
+fi
+
+cd $repo
+ git fetch origin +$branch:$branch +refs/tags/$tag:refs/tags/$tag
+ git log -p --reverse $tag..$branch | filter > ../$out.tmp
+cd ..
+
+if ! test -s $out.tmp; then
+ echo >&2 "No diffs..."
+ rm -f $out.tmp
+ exit 0
+fi
+
+if cmp -s $out{,.tmp}; then
+ echo >&2 "No new diffs..."
+ rm -f $out.tmp
+ exit 0
+fi
+mv -f $out{.tmp,}
+
+../md5 $package.spec
+../dropin $out