#! /bin/bash
_libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
. "$_libdir"/wd-functions.sh
gitdir=$("$_libdir"/linux_git.sh)
if ! $using_git; then
echo "ERROR: not in a git working directory."
exit 1
fi
trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d /tmp/${0##*/}.XXXXXX)
branch=$(get_branch_name)
base=$(git rev-parse --abbrev-ref @{u})
[ $? = 0 ] || exit $?
tag=v$(source rpm/config.sh; echo "$SRCVERSION")
git --git-dir=$gitdir describe $tag > /dev/null || { echo Cannot find $tag in $gitdir ; exit 1 ; }
fixes_res=0
git suse -f "$tmp/gf-ign" --blacklist "$tmp/gf-bl" \
--path-blacklist "$tmp/gf-pbl" &>>"$tmp/check"
fixes_cur=$?; [ $fixes_cur = 0 ] || fixes_res=$fixes_cur
git suse -f "$tmp/gf-commits" --base "$base" \
&>>"$tmp/check"
fixes_cur=$?; [ $fixes_cur = 0 ] || fixes_res=$fixes_cur
git fixes -f "$tmp/gf-commits" --blacklist "$tmp/gf-bl" \
--path-blacklist "$tmp/gf-pbl" \
--ignore-file "$tmp/gf-ign" \
--repo $gitdir \
--no-grouping "$tag..origin/master" &>>"$tmp/check"
#FIXME ^^^^^^^^^^^^ hardcoded
fixes_cur=$?; [ $fixes_cur = 0 ] || fixes_res=$fixes_cur
if [ $fixes_res = 0 ] && grep -q '^Nothing found$' "$tmp/check"; then
echo PASS
else
echo FAIL
echo "git fixes output:"
cat "$tmp/check"
echo
echo "Please include these fixes or add the commit ids to blacklist.conf"
# do not fail automerge due to missing fixes
fi
# vim: et:sts=4:sw=4