Skip to content

Commit 523a1a4

Browse files
authored
fix: subject and summary should be allowed to have 1 char (#61)
1 parent 2474065 commit 523a1a4

File tree

5 files changed

+34617
-29335
lines changed

5 files changed

+34617
-29335
lines changed

corpus/body.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,16 @@ This is a simple body
207207
(message
208208
(overflow)))
209209

210+
================================================================================
211+
Allows 1 char summary
212+
================================================================================
213+
This is a simple subject
214+
215+
T
216+
--------------------------------------------------------------------------------
217+
218+
(source
219+
(subject)
220+
(message))
221+
222+

corpus/subject.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ This should not exists
9292
--------------------------------------------------------------------------------
9393

9494
(source
95-
(subject)
96-
(ERROR))
95+
(ERROR
96+
(subject))
97+
(subject))
9798

9899
================================================================================
99100
Subject with type and scope
@@ -157,7 +158,7 @@ feat(issue42): allow numbers in scope
157158

158159
(source
159160
(subject))
160-
161+
161162
================================================================================
162163
Parse fixup!
163164
================================================================================
@@ -223,3 +224,13 @@ feat(hi):some message
223224
(prefix
224225
(type)
225226
(scope))))
227+
228+
================================================================================
229+
Allows 1 char subject
230+
================================================================================
231+
o
232+
233+
--------------------------------------------------------------------------------
234+
235+
(source
236+
(subject))

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const NEWLINE = /\r?\n/;
22
const ANYTHING = /[^\n\r]+/;
3-
const SUBJECT = /[^\n\r]{1,49}/;
3+
const SUBJECT = /[^\n\r]{0,49}/;
44
const NOT_A_COMMENT = /[^#]/;
5-
const SUMMARY = /[^\n\r]{1,72}/;
5+
const SUMMARY = /[^\n\r]{0,72}/;
66
const SCISSORS = /# -+ >8 -+\r?\n/;
77
const BRANCH_NAME = /[^\s'»"]+/;
88
const COMMIT = /[0-9a-f]{7,40}/;

src/grammar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
},
150150
{
151151
"type": "PATTERN",
152-
"value": "[^\\n\\r]{1,49}"
152+
"value": "[^\\n\\r]{0,49}"
153153
}
154154
]
155155
},
@@ -289,7 +289,7 @@
289289
},
290290
{
291291
"type": "PATTERN",
292-
"value": "[^\\n\\r]{1,72}"
292+
"value": "[^\\n\\r]{0,72}"
293293
}
294294
]
295295
},

0 commit comments

Comments
 (0)