Blob Blame History Raw
#! /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)

if [[ -n $1 ]]; then
    base="${1}"
else
    base=$(git rev-parse --abbrev-ref @{u})
    ret=$?
    if [[ $ret -ne 0 ]]; then
        echo "Try calling \`$0 <base-ref>\` or setup tracking branch with \`git branch -u ...\`." >&2
        exit $ret
    fi
fi
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 ($(grep 'gf-commits$' $tmp/check | cut -d' ' -f2) commits checked)"
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