diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index 0966ec9e4..a854b8fc0 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -164,7 +164,7 @@ class PullRequest < ActiveRecord::Base def merge clone message = "Merge pull request ##{serial_id} from #{from_project_owner_uname}/#{from_project_name}:#{from_ref}\r\n #{title}" - %x(cd #{path} && git checkout #{to_ref} && git merge --no-ff #{from_branch} -m #{message.shellescape}) + %x(cd #{path} && git checkout #{to_ref.shellescape} && git merge --no-ff #{from_branch.shellescape} -m #{message.shellescape}) end def clone @@ -194,8 +194,9 @@ class PullRequest < ActiveRecord::Base system 'git', 'reset', '--hard', "origin/#{to_ref}" end unless tags.include? from_ref - system 'git', 'branch', '-D', from_branch - system 'git', 'fetch', head, "+#{from_ref}:#{from_branch}" + system 'git', 'checkout', from_branch + system 'git', 'reset', '--hard', "#{head}/#{from_ref}" + system 'git', 'checkout', to_ref end end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 98a9d21f5..ed182ee10 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,20 @@ # -*- encoding : utf-8 -*- + +class DisableAssetsLogger + def initialize(app) + @app = app + Rails.application.assets.logger = Logger.new('/dev/null') + end + + def call(env) + previous_level = Rails.logger.level + Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 + @app.call(env) + ensure + Rails.logger.level = previous_level + end +end + Rosa::Application.configure do # Settings specified here will take precedence over those in config/application.rb @@ -40,4 +56,6 @@ Rosa::Application.configure do # Log the query plan for queries taking more than this (works with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5 + + config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger end