0

How to config git hook for detecting exactly selected folder (exem /../../schemas) and exactly selected file extension (exem *.xsd)?

Slava Podolskiy
  • 155
  • 1
  • 11

1 Answers1

2

You can run git diff to see all changes and grep results by the pattern you like. Like this

all_changes=$(git diff --cached --find-copies --find-renames --name-only --diff-filter=ACR)
only_xsd_files=$(echo $all_changes | grep "\.xsd")
only_schemas=$(echo $only_xsd_files | grep "path/to/schemas")

And then you can run rest of your script

Moti Korets
  • 3,738
  • 2
  • 26
  • 35