Jacko
Jacko

Reputation: 13195

Want Git post receive hook to detect certain file types

I would like my post-receive hook to run a certain script whenever files of a certain type, *.hbm.xml are pushed to the server. Motivation: I want to rev my database schema version number whenever NHibernate files are changed.

Thanks!

Upvotes: 1

Views: 384

Answers (1)

Jacko
Jacko

Reputation: 13195

This is what I came up with:

for i in `git show --pretty="format:" --name-only HEAD | grep '.*\.hbm\.xml' `; do
    # call script here.....
    exit
done

Upvotes: 1

Related Questions