#!/bin/sh

. ./conf.py

# Must be 1..9
test x"min_lines" = x"" && exit 1

test -f "$1" || exit $?

sort -t: -k4 -rn -- "$1" >"$1.sorted"

# We do not sort .filtered file because
# it is in fact faster to recompile kernel when all changes
# to same file are tested in sequence.
# For example, if you touch asm/bitops.h, almost everything gets recompiled.
# When you revert that, and touch something else, everything gets recompiled
# AGAIN. Better to touch asm/bitops.h N times in a row, than N times
# interspersed by other files!
grep -e ':[1-9][0-9][0-9]*$' -e ":[${min_lines}-9]\$" -- "$1" | sh -c "$exclude_files" >"$1.filtered"
