Skip to content
Snippets Groups Projects
Commit cea58beb authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge remote-tracking branch 'ce/7-14-stable' into 7-14-stable-ee

parents d7734952 032d2442
No related branches found
No related tags found
No related merge requests found
Please view this file on the master branch, on stable branches it's out of date.
 
v 7.14.0 (unreleased)
- Fix bug where non-project members of the target project could set labels on new merge requests.
- Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller)
- Fix redirection after sign in when using auto_sign_in_with_provider
- Upgrade gitlab_git to 7.2.14 to ignore CRLFs in .gitmodules (Stan Hu)
Loading
Loading
7.14.0.rc2-ee
\ No newline at end of file
7.14.0.rc2-ee
Loading
Loading
@@ -8,6 +8,28 @@ class Projects::BlameController < Projects::ApplicationController
 
def show
@blob = @repository.blob_at(@commit.id, @path)
@blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
@blame = group_blame_lines
end
def group_blame_lines
blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
prev_sha = nil
groups = []
current_group = nil
blame.each do |commit, line|
if prev_sha && prev_sha == commit.sha
current_group[:lines] << line
else
groups << current_group if current_group.present?
current_group = { commit: commit, lines: [line] }
end
prev_sha = commit.sha
end
groups << current_group if current_group.present?
groups
end
end
%p.slead
Should you ever lose your phone, each of these recovery codes can be used one
time each to regain access to your account. Please save them in a safe place.
time each to regain access to your account. Please save them in a safe place, or you
%b will
lose access to your account.
 
.codes.well
%ul
Loading
Loading
Loading
Loading
@@ -13,30 +13,32 @@
.file-content.blame.highlight
%table
- current_line = 1
- @blame.each do |raw_commit, line|
- @blame.each do |blame_group|
%tr
%td.blame-commit
.commit
- unless @prev_commit && @prev_commit.sha == raw_commit.sha
- commit = Commit.new(raw_commit, @project)
.commit-row-title
%strong
= link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark"
.pull-right
= link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace"
&nbsp;
.light
= commit_author_link(commit, avatar: false)
authored
#{time_ago_with_tooltip(commit.committed_date)}
- @prev_commit = raw_commit
- commit = Commit.new(blame_group[:commit], @project)
.commit-row-title
%strong
= link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark"
.pull-right
= link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace"
&nbsp;
.light
= commit_author_link(commit, avatar: false)
authored
#{time_ago_with_tooltip(commit.committed_date)}
%td.lines.blame-numbers
%pre
= current_line
- current_line += 1
- line_count = blame_group[:lines].count
- (current_line...(current_line + line_count)).each do |i|
= i
\
- current_line += line_count
%td.lines
%pre{class: 'code highlight white'}
%code
:erb
<%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
- blame_group[:lines].each do |line|
:erb
<%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
 
Loading
Loading
@@ -38,7 +38,7 @@
.clearfix
.error-alert
%hr
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
- if can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project)
.form-group
.issue-assignee
= f.label :assignee_id, class: 'control-label' do
Loading
Loading
Loading
Loading
@@ -7,14 +7,15 @@ class Database
def initialize
@config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
@db_dir = File.join(Gitlab.config.backup.path, 'db')
end
def dump
FileUtils.rm_rf(@db_dir)
# Ensure the parent dir of @db_dir exists
FileUtils.mkdir_p(Gitlab.config.backup.path)
# Fail if somebody raced to create @db_dir before us
FileUtils.mkdir(@db_dir, mode: 0700)
end
 
def dump
success = case config["adapter"]
when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... "
Loading
Loading
require 'spec_helper'
describe Projects::BlameController do
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
sign_in(user)
project.team << [user, :master]
controller.instance_variable_set(:@project, project)
end
describe "GET show" do
render_views
before do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
id: id)
end
context "valid file" do
let(:id) { 'master/files/ruby/popen.rb' }
it { is_expected.to respond_with(:success) }
it 'groups blames properly' do
blame = assigns(:blame)
# Sanity check a few items
expect(blame.count).to eq(18)
expect(blame[0][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
expect(blame[0][:lines]).to eq(["require 'fileutils'", "require 'open3'", ""])
expect(blame[1][:commit].sha).to eq('874797c3a73b60d2187ed6e2fcabd289ff75171e')
expect(blame[1][:lines]).to eq(["module Popen", " extend self"])
expect(blame[-1][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
expect(blame[-1][:lines]).to eq([" end", "end"])
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment