From 19b61b07ba0cd9f43e231e72b598f9cd6b477522 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 23 Jul 2018 13:30:35 +0200 Subject: commit-msg: quote the filename, fix printed message Quote the filename in case it contains spaces or other special chars. Change-Id: I5ff901de0839551c06bc73b8bef631b64aff5199 Fixes: v2.9.0rc0-1078-gc20432285a ("git hooks: prevent first commit message line to exceed 80 chars.") Reviewed-on: https://code.wireshark.org/review/28827 Reviewed-by: Dario Lombardo Reviewed-by: Peter Wu --- tools/commit-msg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/commit-msg b/tools/commit-msg index cefedd0e8a..6ac323c8a4 100755 --- a/tools/commit-msg +++ b/tools/commit-msg @@ -184,10 +184,10 @@ _gen_ChangeId() { } reject_long_message() { - read -r firstline < $MSG + read -r firstline < "$MSG" if [ ${#firstline} -gt 80 ] then - echo "\n\nERROR: First line in the commit message must not exceed 80 characters\n\n" + printf "\n\nERROR: First line in the commit message must not exceed 80 characters\n\n" exit 1 fi } -- cgit v1.2.3