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