File tree Expand file tree Collapse file tree 3 files changed +24
-14
lines changed Expand file tree Collapse file tree 3 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
#
3
3
# An example hook script to check the commit log message.
4
4
# Called by "git commit" with one argument, the name of the file
@@ -77,7 +77,8 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
77
77
# Check that the first line of the commit starts with a
78
78
# capitalized letter.
79
79
if ! (head -n 1 $1 | grep ' ^[A-Z]' & > /dev/null ); then
80
- echo >&2 " First word of commit message must be a capitalized imperative verb.\n"
80
+ echo >&2 " First word of commit message must be a capitalized imperative verb."
81
+ echo " "
81
82
let status=1
82
83
fi
83
84
@@ -89,23 +90,28 @@ cat $1 | \
89
90
nchars=$( wc -c <<< $line )
90
91
if [[ " $ln " -eq " 1" ]]; then
91
92
if [[ " $nchars " -gt " 51" ]]; then
92
- echo >&2 " First line of commit message too long ($nchars > 50 chars)\n"
93
+ echo >&2 " First line of commit message too long ($nchars > 50 chars)"
94
+ echo " "
93
95
let status=1
94
96
fi
95
97
elif [[ " $ln " -eq " 2" ]]; then
96
98
if [[ " $nchars " -gt " 1" ]] && ! grep ' ^#' <<< " $line" > /dev/null; then
97
- echo >&2 " Second line of commit message not blank\n"
99
+ echo >&2 " Second line of commit message not blank"
100
+ echo " "
98
101
let status=1
99
102
fi
100
103
else
101
104
if [[ " $nchars " -gt " 72" ]]; then
102
- echo >&2 " Line $ln of commit message too long ($nchars > 72 chars)\n"
105
+ echo >&2 " Line $ln of commit message too long ($nchars > 72 chars)"
106
+ echo " "
103
107
let status=1
104
108
fi
105
109
fi
106
110
done
107
111
108
- if [[ $status != 0 ]]; then
109
- error_message
110
- exit 1
112
+ if [[ $status = 0 ]]; then
113
+ exit 0
111
114
fi
115
+
116
+ error_message
117
+ exit 1
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
#
3
3
# An example hook script to verify what is about to be committed.
4
4
# Called by "git commit" with no arguments. The hook should
@@ -71,15 +71,18 @@ for f in $(git diff-index --name-status --cached $against | grep -v ^D | cut -c3
71
71
if [[ " $f " =~ ([.](h| m| c| rb| sh| py| txt| md| f90| F90| cmake| x64| csh)| makefile| Makefile)$ ]] ||
72
72
head -n 1 | grep ' ^#!/' ; then
73
73
if ! ends_with_newline " $f " ; then
74
- echo & > 2 " No newline at end of file: $f \n"
74
+ echo & > 2 " No newline at end of file: $f "
75
+ echo " "
75
76
let status=1
76
77
fi
77
78
fi
78
79
done
79
80
80
81
# If there are whitespace errors, print the offending file names and fail.
81
- git diff-index --check --cached $against -- || let status=1
82
+ git diff-index --check --cached $against -- || ( let status=1 echo ' white space violations found ' )
82
83
83
- if [[ $status ! = 0 ]]; then
84
- exit 1
84
+ if [[ $status = 0 ]]; then
85
+ exit 0
85
86
fi
87
+
88
+ exit 1
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ if [[ "$1" ]]; then
8
8
echo " WARNING: Settings will be applied globally. This may over-write some of your global git settings."
9
9
read -p " Press Ctrl-C to abort, and try again without \` --global\` or press any key to contibue" foo
10
10
else
11
- echo -e " Usage: $0 [--global] [--help]\n"
11
+ echo " Usage: $0 [--global] [--help]"
12
+ echo " "
12
13
echo " This script is to configure your git environment"
13
14
echo " For contributing to OpenCoarrays. The \` --help\` "
14
15
echo " flag will print this message. The \` --global\` "
You can’t perform that action at this time.
0 commit comments