Skip to content

Commit

Permalink
Fix multiple issue URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Nov 8, 2017
1 parent 0c5a093 commit ddcffe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MATCH_STATS = /(\d+) files? changed(?:, (\d+) insertions?...)?(?:, (\d+) d
const TAG_PREFIX = 'tag: '

// https://help.github.com/articles/closing-issues-via-commit-messages
const FIX_PATTERN = /(?:close[sd]?|fixe?[sd]?|resolve[sd]?)\s(?:#(\d+)|(https?:\/\/.+\/issues\/(\d+)))/gi
const FIX_PATTERN = /(?:close[sd]?|fixe?[sd]?|resolve[sd]?)\s(?:#(\d+)|(https?:\/\/.+?\/issues\/(\d+)))/gi

const MERGE_PATTERNS = [
/Merge pull request #(\d+) from .+\n\n(.+)/, // Regular GitHub merge
Expand Down
8 changes: 8 additions & 0 deletions test/commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ describe('getFixes', () => {
])
})

it('parses multiple fixes by issue URL', () => {
const message = 'Commit message\n\nFixes https://github.com/user/repo/issues/1 and fixes https://github.com/user/repo/issues/2'
expect(getFixes(message, origins.github)).to.deep.equal([
{ id: '1', href: 'https://github.com/user/repo/issues/1' },
{ id: '2', href: 'https://github.com/user/repo/issues/2' }
])
})

it('parses external repo issues', () => {
const message = 'Commit message\n\nFixes https://github.com/other-user/external-repo/issues/1'
expect(getFixes(message, origins.github)).to.deep.equal([
Expand Down

0 comments on commit ddcffe0

Please sign in to comment.