bisect-create 1.06 KB
Newer Older
1 2 3 4
#!/bin/sh

set -e

5 6 7
if test "bisect-create" = "`basename $0`" ; then
    echo tools/ffbisect created
    git show master:tools/bisect-create > tools/ffbisect
8 9 10 11
    chmod u+x tools/ffbisect
    exit 1
fi

12
if ! git show master:tools/bisect-create | diff - tools/ffbisect > /dev/null ; then
13
    echo updating tools/ffbisect script to HEAD.
14
    git show master:tools/bisect-create > tools/ffbisect
15 16 17 18 19
    chmod u+x tools/ffbisect
    tools/ffbisect $*
    exit 0
fi

20 21 22 23
case "$1" in
    need)
        case $2 in
            ffmpeg|ffplay|ffprobe|ffserver)
24
                echo $2.c >> tools/bisect.need
25 26 27 28
            ;;
        esac
    ;;
    start|reset)
29
        echo . > tools/bisect.need
30 31 32 33 34 35 36 37
        git bisect $*
    ;;
    skip)
        git bisect $*
    ;;
    good|bad)
        git bisect $*

38
        until ls `cat tools/bisect.need` > /dev/null 2> /dev/null; do
39 40 41
            git bisect skip || break
        done
    ;;
42 43 44 45
    run)
       shift # remove "run" from arguments
       git bisect run sh -c "ls \`cat tools/bisect.need\` > /dev/null 2> /dev/null || exit 125; \"\$@\"" sh "$@"
    ;;
46
esac