diff --git a/app/views/repositories/_proj_ajax.js.erb b/app/views/repositories/_proj_ajax.js.erb index ff7e5ff00..9fd8431d4 100644 --- a/app/views/repositories/_proj_ajax.js.erb +++ b/app/views/repositories/_proj_ajax.js.erb @@ -6,7 +6,7 @@ <% @projects.each do |project| %> [ "<%=j link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project) %>", - "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ') %>", + "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ').gsub("\r", ' ') %>", "<%=j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>" ]<%= project == @projects.last ? '' : ',' %> <% end %> diff --git a/app/views/repositories/_project.js.erb b/app/views/repositories/_project.js.erb index 91050c158..11e30ec45 100644 --- a/app/views/repositories/_project.js.erb +++ b/app/views/repositories/_project.js.erb @@ -13,7 +13,7 @@ j(link_to("#{project.owner.respond_to?(:uname) ? project.owner.uname : project.owner.name} / #{project.name}", project)) + "").html_safe %>", - "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ') %>", + "<%= truncate(project.description || '', :length => 60).gsub("\n", ' ').gsub("\r", ' ') %>", "<%= if can? :remove_project, @repository j(link_to(' '.html_safe, diff --git a/lib/tasks/add_branch.rake b/lib/tasks/add_branch.rake index 1a7b96bd5..c8d7cf48d 100644 --- a/lib/tasks/add_branch.rake +++ b/lib/tasks/add_branch.rake @@ -9,12 +9,12 @@ task :add_branch => :environment do Platform.find_by_name(dst_branch).repositories.each do |r| say "=== Process #{r.name} repo" r.projects.find_each do |p| + next if p.branches.map(&:name).include?(dst_branch) say "===== Process #{p.name} project" tmp_path = Rails.root.join('tmp', p.name) system("git clone #{p.path} #{tmp_path}") - system("cd #{tmp_path} && git checkout remotes/origin/#{src_branch}") or system("cd #{tmp_path} && git checkout master") - system("cd #{tmp_path} && git checkout -b #{dst_branch}") - system("cd #{tmp_path} && git push origin HEAD") + system("cd #{tmp_path} && git checkout remotes/origin/#{src_branch} || git checkout master") + system("cd #{tmp_path} && git checkout -b #{dst_branch} && git push origin HEAD") FileUtils.rm_rf tmp_path end end