Don't show timeout message for empty diffs (ie. blank file added)
[gitorious.git] / lib / index_hint.rb
blobdff5355bff3d4e6d0c1ac0c39b824d31123b9757
1 # encoding: utf-8
2 #--
3 #   Copyright (C) 2013 Gitorious AS
5 #   This program is free software: you can redistribute it and/or modify
6 #   it under the terms of the GNU Affero General Public License as published by
7 #   the Free Software Foundation, either version 3 of the License, or
8 #   (at your option) any later version.
10 #   This program is distributed in the hope that it will be useful,
11 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #   GNU Affero General Public License for more details.
15 #   You should have received a copy of the GNU Affero General Public License
16 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #++
19 module IndexHint
20   def use_index(index)
21     return "use index (#{index})" if mysql_adapter?
22   end
24   private
26   def mysql_adapter?
27     Rails.configuration.database_configuration[Rails.env.to_s]["adapter"] =~ /mysql/
28   end
29 end