#!/bin/sh usage() { echo >&2 "Usage: $0 [ --not ] [ --set | --unset | --unspecified ] ..."; } state=set if test $1 = "--not"; then not=true shift else not=false fi case $1 in --set) state=set; shift;; --unspecified) state=unspecified; shift;; --unset) state=unset; shift;; -*) usage; exit 1;; esac if test -z "$1"; then usage; exit 1; fi attr=$1 shift git ls-files "$@" | git check-attr --stdin $attr | if $not; then awk -F': ' -v state=$state '{ if ($3 != state) print $1 }' else awk -F': ' -v state=$state '{ if ($3 == state) print $1 }' fi