Something like:
for commit in $(git rev-list $branch)
do
if git ls-tree --name-only -r $commit | grep -q '\.hbm\.xml$'; then
echo $commit
exit 0
fi
done
Note that git show
will only list files which have changed in that commit, if you want to know whether there is a path that matches a particular pattern in a commit you need to use something like git ls-tree
.