Index: build/git-hooks/pre-commit |
diff --git a/build/git-hooks/pre-commit b/build/git-hooks/pre-commit |
index 3391a777e760afca4f6a1401863e04f87c095319..1153649842c3fc765765b18a93c397ba5b5012d7 100755 |
--- a/build/git-hooks/pre-commit |
+++ b/build/git-hooks/pre-commit |
@@ -23,7 +23,8 @@ EOF |
exit 1 |
fi |
-if test "$(git diff-index --cached HEAD .gitmodules)"; then |
+if [[ -n "$(git ls-files .gitmodules)" && |
+ -n "$(git diff-index --cached HEAD .gitmodules)" ]]; then |
cat <<EOF 1>&2 |
You are trying to commit a change to .gitmodules. That is not allowed. |
To make changes to submodule names/paths, edit DEPS. |