]> source.dussan.org Git - redmine.git/commitdiff
Fixed: using '*' as keyword for repository referencing keywords doesn't work when...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 May 2008 11:43:20 +0000 (11:43 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 25 May 2008 11:43:20 +0000 (11:43 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1451 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/changeset.rb
test/unit/changeset_test.rb

index 9a05e6a6810163a2ed9e47179a22891ec1c323ec..41f5ed86a4fc57b273ab0d577fb943deddb5782d 100644 (file)
@@ -75,7 +75,7 @@ class Changeset < ActiveRecord::Base
     if ref_keywords.delete('*')
       # find any issue ID in the comments
       target_issue_ids = []
-      comments.scan(%r{([\s\(,-^])#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
+      comments.scan(%r{([\s\(,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
       referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids)
     end
     
index bbfe6952debaa6821f307dca8c5386e5f89c0c30..6cc53d852a064e7c1a4f5a066826c42d6f72c3ea 100644 (file)
@@ -39,6 +39,17 @@ class ChangesetTest < Test::Unit::TestCase
     assert fixed.closed?
     assert_equal 90, fixed.done_ratio
   end
+  
+  def test_ref_keywords_any_line_start
+    Setting.commit_ref_keywords = '*'
+
+    c = Changeset.new(:repository => Project.find(1).repository,
+                      :committed_on => Time.now,
+                      :comments => '#1 is the reason of this commit')
+    c.scan_comment_for_issue_ids
+
+    assert_equal [1], c.issue_ids.sort
+  end
 
   def test_previous
     changeset = Changeset.find_by_revision('3')