From ea2c4b57d80a2d29f521ac1f310e41d9fc37292d Mon Sep 17 00:00:00 2001 From: rgnkn Date: Sun, 10 Apr 2022 20:22:28 +0200 Subject: [PATCH 1/3] feat: Allow mark signs in commit message. --- conventional-pre-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conventional-pre-commit.sh b/conventional-pre-commit.sh index 7deeb11..78f834f 100755 --- a/conventional-pre-commit.sh +++ b/conventional-pre-commit.sh @@ -25,7 +25,7 @@ r_scope="(\([[:alnum:] \/-]+\))?" # optional breaking change indicator and colon delimiter r_delim='!?:' # subject line, body, footer -r_subject=" [[:alnum:]].+" +r_subject=" [[:print:]].+" # the full regex pattern pattern="^$r_types$r_scope$r_delim$r_subject$" From 4db8c11ece868d976960ae79666ffbf7f81e5077 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Fri, 15 Apr 2022 15:48:10 -0700 Subject: [PATCH 2/3] test: special characters in commit message --- tests.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/tests.sh b/tests.sh index 7c12959..cc982ce 100755 --- a/tests.sh +++ b/tests.sh @@ -27,7 +27,7 @@ teardown () { rm -rf "$test_dir" } -# test a failure +echo "test a failure" setup @@ -39,7 +39,7 @@ echo "$fail" | grep -Eq "Your commit message does not follow Conventional Commit (( result += "$?" )) -# test a success +echo "test a success" setup @@ -51,4 +51,54 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "test printable characters/marks in subject" + +echo "test escaped double quote \"" + +setup + +pass="$(git commit -m 'test: conventional-pre-commit \"')" + +teardown + +echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \"" + +(( result += "$?" )) + +echo "test backtick \`" + +setup + +pass="$(git commit -m 'test: conventional-pre-commit \`')" + +teardown + +echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \`" + +(( result += "$?" )) + +echo "test hash/number sign #" + +setup + +pass="$(git commit -m 'test: conventional-pre-commit #')" + +teardown + +echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit #" + +(( result += "$?" )) + +echo "test ampersand &" + +setup + +pass="$(git commit -m 'test: conventional-pre-commit &')" + +teardown + +echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit &" + +(( result += "$?" )) + exit "$result" From 51f401041382f78662d6e248504dbc724f252d9b Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Fri, 15 Apr 2022 15:59:03 -0700 Subject: [PATCH 3/3] fix(tests): fix syntax, log results --- tests.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests.sh b/tests.sh index cc982ce..75220e3 100755 --- a/tests.sh +++ b/tests.sh @@ -39,6 +39,8 @@ echo "$fail" | grep -Eq "Your commit message does not follow Conventional Commit (( result += "$?" )) +echo "$result" + echo "test a success" setup @@ -51,13 +53,15 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "$result" + echo "test printable characters/marks in subject" echo "test escaped double quote \"" setup -pass="$(git commit -m 'test: conventional-pre-commit \"')" +pass="$(git commit -m 'test: conventional-pre-commit "')" teardown @@ -65,11 +69,13 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "$result" + echo "test backtick \`" setup -pass="$(git commit -m 'test: conventional-pre-commit \`')" +pass="$(git commit -m 'test: conventional-pre-commit `')" teardown @@ -77,6 +83,8 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "$result" + echo "test hash/number sign #" setup @@ -89,6 +97,8 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "$result" + echo "test ampersand &" setup @@ -101,4 +111,6 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio (( result += "$?" )) +echo "$result" + exit "$result"