diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-16 11:16:53 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-16 11:16:53 +0000 |
commit | 724afdf49d0c1875af06ad5137608a58446882c2 (patch) | |
tree | 5a9ba4ac2af18eae4ea89608f388a74ba4f11a4f /app/models | |
parent | 862058795fb215bef4569bce1d883f0c1adafa27 (diff) | |
download | redmine-724afdf49d0c1875af06ad5137608a58446882c2.tar.gz redmine-724afdf49d0c1875af06ad5137608a58446882c2.zip |
scm: git: implement find_changeset_by_name (#7047).
SQL "like" is slow.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4851 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository/git.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 26cb84db9..8fb6325b0 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -47,6 +47,13 @@ class Repository::Git < Repository scm.tags end + def find_changeset_by_name(name) + return nil if name.nil? || name.empty? + e = changesets.find(:first, :conditions => ['revision = ?', name.to_s]) + return e if e + changesets.find(:first, :conditions => ['scmid LIKE ?', "#{name}%"]) + end + # With SCM's that have a sequential commit numbering, redmine is able to be # clever and only fetch changesets going forward from the most recent one # it knows about. However, with git, you never know if people have merged |