git hooks: fix submodule check sloppy match

Submodule check used to match any file containing submodule name (e.g.
lib/include/ihk/foo would match ihk and incorrectly be identified as
a submodule change) -- properly check for full name with anchors instead

Change-Id: Ib4330aec97e9da713cd3ab9e791962f2e0c8d396
This commit is contained in:
Dominique Martinet
2019-01-29 15:19:49 +09:00
committed by Masamichi Takagi
parent 9bf225d193
commit 3738b70ad3

View File

@ -44,7 +44,7 @@ fi
SUBMODULES=$(sed -ne 's/^.*path = //p' "${ROOT_DIR}/.gitmodules")
# Finding the submodules that have been modified
MOD_SUBMODULES=$(git diff --cached --name-only | grep -F "$SUBMODULES")
MOD_SUBMODULES=$(git diff --cached --name-only | grep -E "^(${SUBMODULES//$'\n'/|})$")
# If no modified submodules, exit with status code 0, else prompt the
# user and exit accordingly