[#19] add regexp explanation and source
This commit is contained in:
parent
37b72081c7
commit
f8fc825ca4
|
@ -132,6 +132,10 @@ class Comment < ActiveRecord::Base
|
||||||
def self.create_link_on_issues_from_commits git_hook, commits
|
def self.create_link_on_issues_from_commits git_hook, commits
|
||||||
system_user = User.find_by_uname 'rosa_system'
|
system_user = User.find_by_uname 'rosa_system'
|
||||||
commits.each do |commit|
|
commits.each do |commit|
|
||||||
|
# regexp take from http://code.google.com/p/concerto-platform/source/browse/v3/cms/lib/CodeMirror/mode/gfm/gfm.js?spec=svn861&r=861#71
|
||||||
|
# User/Project#Num
|
||||||
|
# User#Num
|
||||||
|
# #Num
|
||||||
commit[1].scan(/(?:[a-zA-Z0-9\-_]*\/)?(?:[a-zA-Z0-9\-_]*)?#[0-9]+/).each do |hash|
|
commit[1].scan(/(?:[a-zA-Z0-9\-_]*\/)?(?:[a-zA-Z0-9\-_]*)?#[0-9]+/).each do |hash|
|
||||||
hash =~ /([a-zA-Z0-9\-_]*\/)?([a-zA-Z0-9\-_]*)?#([0-9]+)/
|
hash =~ /([a-zA-Z0-9\-_]*\/)?([a-zA-Z0-9\-_]*)?#([0-9]+)/
|
||||||
owner_uname = Regexp.last_match[1].presence || git_hook.project.owner.uname
|
owner_uname = Regexp.last_match[1].presence || git_hook.project.owner.uname
|
||||||
|
|
Loading…
Reference in New Issue