Skip to content

Commit 489e481

Browse files
authored
Merge pull request #17 from rgnkn/allow_marks
feat: Allow mark signs in commit message.
2 parents 934e4b6 + 51f4010 commit 489e481

File tree

2 files changed

+65
-3
lines changed

2 files changed

+65
-3
lines changed

conventional-pre-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ r_scope="(\([[:alnum:] \/-]+\))?"
2525
# optional breaking change indicator and colon delimiter
2626
r_delim='!?:'
2727
# subject line, body, footer
28-
r_subject=" [[:alnum:]].+"
28+
r_subject=" [[:print:]].+"
2929
# the full regex pattern
3030
pattern="^$r_types$r_scope$r_delim$r_subject$"
3131

tests.sh

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ teardown () {
2727
rm -rf "$test_dir"
2828
}
2929

30-
# test a failure
30+
echo "test a failure"
3131

3232
setup
3333

@@ -39,7 +39,9 @@ echo "$fail" | grep -Eq "Your commit message does not follow Conventional Commit
3939

4040
(( result += "$?" ))
4141

42-
# test a success
42+
echo "$result"
43+
44+
echo "test a success"
4345

4446
setup
4547

@@ -51,4 +53,64 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio
5153

5254
(( result += "$?" ))
5355

56+
echo "$result"
57+
58+
echo "test printable characters/marks in subject"
59+
60+
echo "test escaped double quote \""
61+
62+
setup
63+
64+
pass="$(git commit -m 'test: conventional-pre-commit "')"
65+
66+
teardown
67+
68+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \""
69+
70+
(( result += "$?" ))
71+
72+
echo "$result"
73+
74+
echo "test backtick \`"
75+
76+
setup
77+
78+
pass="$(git commit -m 'test: conventional-pre-commit `')"
79+
80+
teardown
81+
82+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \`"
83+
84+
(( result += "$?" ))
85+
86+
echo "$result"
87+
88+
echo "test hash/number sign #"
89+
90+
setup
91+
92+
pass="$(git commit -m 'test: conventional-pre-commit #')"
93+
94+
teardown
95+
96+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit #"
97+
98+
(( result += "$?" ))
99+
100+
echo "$result"
101+
102+
echo "test ampersand &"
103+
104+
setup
105+
106+
pass="$(git commit -m 'test: conventional-pre-commit &')"
107+
108+
teardown
109+
110+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit &"
111+
112+
(( result += "$?" ))
113+
114+
echo "$result"
115+
54116
exit "$result"

0 commit comments

Comments
 (0)