File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
main/java/org/opengrok/indexer/history
test/java/org/opengrok/indexer/history Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class GitTagParser implements Executor.StreamHandler {
51
51
* <p>d305482d0acf552ccd290d6133a52547b8da16be:1427209918:tag: 0.12.1.5:
52
52
*/
53
53
private static final Pattern PRETTY_TAG_MATCHER =
54
- Pattern .compile ("tag:\\ s+(\\ S[^,:]+ )(?:,\\ s+|:)" );
54
+ Pattern .compile ("tag:\\ s+(\\ S[^,:]* )(?:,\\ s+|:)" );
55
55
56
56
/**
57
57
* Stores the externally provided set.
Original file line number Diff line number Diff line change @@ -230,4 +230,21 @@ public void shouldParseOpenGrokTagsLog() throws IOException {
230
230
assertEquals ("tags should equal" , t2 .tags , floor2 .tags );
231
231
assertEquals ("hashes should equal" , t2 .hash , ((GitTagEntry ) floor2 ).hash );
232
232
}
233
+
234
+ @ Test
235
+ public void shouldParseOneCharacterTags () throws IOException {
236
+ final String LOG =
237
+ "c6963a7ea2753672325502d342e653700be550a8:1377876557:tag: z:\n " +
238
+ "c23e82b612acd5e947c164114377578116f6d298:1163621273::" ;
239
+ final byte [] LOG_BYTES = LOG .getBytes (StandardCharsets .UTF_8 );
240
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream (LOG_BYTES );
241
+
242
+ TreeSet <TagEntry > tagList = new TreeSet <>();
243
+ GitTagParser parser = new GitTagParser (tagList );
244
+ parser .processStream (bytesIn );
245
+
246
+ // See comment about LF count in shouldParseOpenGrokTagsLog().
247
+ long countLF = LOG .chars ().filter (ch -> ch == '\n' ).count ();
248
+ assertEquals ("size should == LF count" , countLF , tagList .size ());
249
+ }
233
250
}
You can’t perform that action at this time.
0 commit comments