diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index fa1f943a8..6912c8a42 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -84,8 +84,8 @@ class PullRequest < ActiveRecord::Base end def path - filename = [id, from_project_owner_uname, from_project_name].compact.join('-') - File.join(APP_CONFIG['git_path'], 'pull_requests', new_record? ? 'tmp' : '', to_project.owner.uname, to_project.name, filename) + last_part = [id, from_project_owner_uname, from_project_name].compact.join('-') + File.join(APP_CONFIG['git_path'], "#{new_record? ? 'temp_' : ''}pull_requests", to_project.owner.uname, to_project.name, last_part) end def from_branch diff --git a/lib/tasks/pull_requests.rake b/lib/tasks/pull_requests.rake index e2fcce9f9..9a1c94081 100644 --- a/lib/tasks/pull_requests.rake +++ b/lib/tasks/pull_requests.rake @@ -2,7 +2,7 @@ namespace :pull_requests do desc 'Remove temporary git repos for pull requests' task :clear => :environment do - Dir.chdir(File.join(APP_CONFIG['git_path'], 'pull_requests', 'tmp')) do + Dir.chdir(File.join(APP_CONFIG['git_path'], 'temp_pull_requests')) do say "Removing repos older one day:" say `find -mindepth 2 -maxdepth 2 -type d -mtime +0` `find -mindepth 2 -maxdepth 2 -type d -mtime +0 | xargs rm -rf`