commit 00d42e99257f840338f308d943f6de44cf164636
Author: John Goerzen <jgoerzen@complete.org>
Date:   Fri Mar 7 19:53:27 2008 -0600

    Include issue refs on closed issues
    
    Consider a case where issue 5 exists in the issue database already and
    is already marked closed.  If you have a "closes" statement in your
    changelog that references a bug that's already closed, no linkage will
    be applied because of this:
    
              next if issue.status.is_closed?
    
    This patch moves the code that updates referenced_issues above that
    test, so that it still will avoid a duplicate attempt to close the
    issue, but nonetheless will add the reference to the issue.

diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 6bd15b1..e3b8c89 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -76,6 +76,7 @@ class Changeset < ActiveRecord::Base
       action = match[0]
       target_issue_ids = match[1].scan(/\d+/)
       target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
+      referenced_issues += target_issues
       if fix_status && fix_keywords.include?(action.downcase)
         # update status of issues
         logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
@@ -92,7 +93,6 @@ class Changeset < ActiveRecord::Base
           Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')
         end
       end
-      referenced_issues += target_issues
     end
     
     self.issues = referenced_issues.uniq
