@@ -75,7 +75,7 class Changeset < ActiveRecord::Base | |||
|
75 | 75 | if ref_keywords.delete('*') |
|
76 | 76 | # find any issue ID in the comments |
|
77 | 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 | 79 | referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) |
|
80 | 80 | end |
|
81 | 81 |
@@ -40,6 +40,17 class ChangesetTest < Test::Unit::TestCase | |||
|
40 | 40 | assert_equal 90, fixed.done_ratio |
|
41 | 41 | end |
|
42 | 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 | |
|
53 | ||
|
43 | 54 | def test_previous |
|
44 | 55 | changeset = Changeset.find_by_revision('3') |
|
45 | 56 | assert_equal Changeset.find_by_revision('2'), changeset.previous |
General Comments 0
You need to be logged in to leave comments.
Login now