@@ -75,7 +75,7 class Changeset < ActiveRecord::Base | |||||
75 | if ref_keywords.delete('*') |
|
75 | if ref_keywords.delete('*') | |
76 | # find any issue ID in the comments |
|
76 | # find any issue ID in the comments | |
77 | target_issue_ids = [] |
|
77 | target_issue_ids = [] | |
78 |
comments.scan(%r{([\s\(,-^ |
|
78 | comments.scan(%r{([\s\(,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } | |
79 | referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) |
|
79 | referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) | |
80 | end |
|
80 | end | |
81 |
|
81 |
@@ -39,6 +39,17 class ChangesetTest < Test::Unit::TestCase | |||||
39 | assert fixed.closed? |
|
39 | assert fixed.closed? | |
40 | assert_equal 90, fixed.done_ratio |
|
40 | assert_equal 90, fixed.done_ratio | |
41 | end |
|
41 | end | |
|
42 | ||||
|
43 | def test_ref_keywords_any_line_start | |||
|
44 | Setting.commit_ref_keywords = '*' | |||
|
45 | ||||
|
46 | c = Changeset.new(:repository => Project.find(1).repository, | |||
|
47 | :committed_on => Time.now, | |||
|
48 | :comments => '#1 is the reason of this commit') | |||
|
49 | c.scan_comment_for_issue_ids | |||
|
50 | ||||
|
51 | assert_equal [1], c.issue_ids.sort | |||
|
52 | end | |||
42 |
|
53 | |||
43 | def test_previous |
|
54 | def test_previous | |
44 | changeset = Changeset.find_by_revision('3') |
|
55 | changeset = Changeset.find_by_revision('3') |
General Comments 0
You need to be logged in to leave comments.
Login now