I have a common git "post-receive" script for several projects, and it needs to perform different actions if an /app/ or /public/ folder exists in the root.
FOLDERS=`git ls-tree -d --name-only -z master`;
I can see the directory listing, and I would like to use the RegExp support in bash to run something like:
if [[ "$FOLDERS" =~ app ]]; then ... fi
But that won't work if there was something like an "app lication" folder... I specified the "-z" option in the git "ls-tree" command so I could use the \0 (null) character as a separator, but not sure how to test for that in the bash RegExp.
Likewise I know there is support for specifying a particular path in the ls-tree command, and could then pipe that to "wc -l", but I'd have thought it was quicker to get a full directory listing of the root (not recursive) then test for the 2 (or more) folders with the returned output.