diff options
Diffstat (limited to 'build-aux/git-hooks/commit-msg')
| -rwxr-xr-x | build-aux/git-hooks/commit-msg | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg index 6a09eddf88b..f407881b0db 100755 --- a/build-aux/git-hooks/commit-msg +++ b/build-aux/git-hooks/commit-msg | |||
| @@ -20,25 +20,32 @@ | |||
| 20 | 20 | ||
| 21 | # Written by Paul Eggert. | 21 | # Written by Paul Eggert. |
| 22 | 22 | ||
| 23 | # Prefer gawk if available, as it handles NUL bytes properly. | ||
| 24 | if type gawk >/dev/null 2>&1; then | ||
| 25 | awk=gawk | ||
| 26 | else | ||
| 27 | awk=awk | ||
| 28 | fi | ||
| 29 | |||
| 23 | # Use a UTF-8 locale if available, so that the UTF-8 check works. | 30 | # Use a UTF-8 locale if available, so that the UTF-8 check works. |
| 24 | # Use U+00A2 CENT SIGN to test whether the locale works. | 31 | # Use U+00A2 CENT SIGN to test whether the locale works. |
| 25 | cent_sign_utf8_octal='\302\242' | 32 | cent_sign_utf8_octal='\302\242' |
| 26 | at_sign=` | 33 | at_sign=` |
| 27 | printf "${cent_sign_utf8_octal}@" | | 34 | printf "${cent_sign_utf8_octal}@" | |
| 28 | awk '{print substr($0, 2)}' 2>/dev/null | 35 | $awk '{print substr($0, 2)}' 2>/dev/null |
| 29 | ` | 36 | ` |
| 30 | if test "$at_sign" != @; then | 37 | if test "$at_sign" != @; then |
| 31 | at_sign=` | 38 | at_sign=` |
| 32 | printf "${cent_sign_utf8_octal}@" | | 39 | printf "${cent_sign_utf8_octal}@" | |
| 33 | LC_ALL=en_US.utf8 awk '{print substr($0, 2)}' 2>/dev/null | 40 | LC_ALL=en_US.UTF-8 $awk '{print substr($0, 2)}' 2>/dev/null |
| 34 | ` | 41 | ` |
| 35 | if test "$at_sign" = @; then | 42 | if test "$at_sign" = @; then |
| 36 | LC_ALL=en_US.utf8; export LC_ALL | 43 | LC_ALL=en_US.UTF-8; export LC_ALL |
| 37 | fi | 44 | fi |
| 38 | fi | 45 | fi |
| 39 | 46 | ||
| 40 | # Check the log entry. | 47 | # Check the log entry. |
| 41 | exec awk ' | 48 | exec $awk ' |
| 42 | /^#/ { next } | 49 | /^#/ { next } |
| 43 | 50 | ||
| 44 | !/^.*$/ { | 51 | !/^.*$/ { |
| @@ -60,8 +67,8 @@ exec awk ' | |||
| 60 | status = 1 | 67 | status = 1 |
| 61 | } | 68 | } |
| 62 | 69 | ||
| 63 | /[[:cntrl:]]/ { | 70 | /[^[:print:]]/ { |
| 64 | print "Text contains control character; please use spaces instead of tabs" | 71 | print "Unprintable character; please use spaces instead of tabs" |
| 65 | status = 1 | 72 | status = 1 |
| 66 | } | 73 | } |
| 67 | 74 | ||
| @@ -76,7 +83,7 @@ exec awk ' | |||
| 76 | } | 83 | } |
| 77 | 84 | ||
| 78 | /^Signed-off-by: / { | 85 | /^Signed-off-by: / { |
| 79 | print "'Signed-off-by:' present" | 86 | print "'\''Signed-off-by:'\'' present" |
| 80 | status = 1 | 87 | status = 1 |
| 81 | } | 88 | } |
| 82 | 89 | ||