Skip to content

Commit

Permalink
Merge pull request mohamicorp#2 from agusmba/fix_internal_regexp
Browse files Browse the repository at this point in the history
Fix internal pattern match for JIRA issues
  • Loading branch information
sford committed Apr 10, 2014
2 parents a5180a3 + 41be335 commit c205ac4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/isroot/stash/plugin/YaccServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private List<String> extractJiraIssuesFromCommitMessage(Settings settings, Chang
}
}

Pattern singleIssuePattern = Pattern.compile("[a-zA-Z]+-[0-9]+");
Pattern singleIssuePattern = Pattern.compile("[A-Z][A-Z_0-9]+-[0-9]+");
Matcher matcher = singleIssuePattern.matcher(message);
while (matcher.find())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void testCheckRefChange_requireJiraIssue_rejectIfNoJiraIssuesAreFound() t
when(jiraService.doesJiraApplicationLinkExist()).thenReturn(true);

Changeset changeset = mockChangeset();
when(changeset.getMessage()).thenReturn("this commit message has no jira issues");
when(changeset.getMessage()).thenReturn("this commit message has no jira issues. abc-123 is not a valid issue because it is lowercase.");
when(changesetsService.getNewChangesets(any(Repository.class), any(RefChange.class))).thenReturn(Sets.newHashSet(changeset));

List<String> errors = yaccService.checkRefChange(null, settings, mockRefChange());
Expand Down Expand Up @@ -165,7 +165,7 @@ public void testCheckRefChange_requireJiraIssue_errorReturnedIfJiraAuthenticatio
when(jiraService.doesIssueExist(anyString())).thenThrow(CredentialsRequiredException.class);

Changeset changeset = mockChangeset();
when(changeset.getMessage()).thenReturn("ABC-123: this commit has valid issue id");
when(changeset.getMessage()).thenReturn("ABC-123: this commit has valid issue id, ABC_D-123: is also a valid issue id");
when(changesetsService.getNewChangesets(any(Repository.class), any(RefChange.class))).thenReturn(Sets.newHashSet(changeset));


Expand Down

0 comments on commit c205ac4

Please sign in to comment.