Commit 413a310faa17f626f351fa3afd6423e8782935a9
1 parent
7e8bf92b
Exists in
master
and in
4 other branches
fixed blame and mr factory
Showing
8 changed files
with
15 additions
and
10 deletions
Show diff stats
app/controllers/blame_controller.rb
@@ -8,6 +8,7 @@ class BlameController < ProjectResourceController | @@ -8,6 +8,7 @@ class BlameController < ProjectResourceController | ||
8 | before_filter :require_non_empty_project | 8 | before_filter :require_non_empty_project |
9 | 9 | ||
10 | def show | 10 | def show |
11 | + @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
11 | @blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path) | 12 | @blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path) |
12 | end | 13 | end |
13 | end | 14 | end |
app/views/blame/show.html.haml
@@ -15,9 +15,9 @@ | @@ -15,9 +15,9 @@ | ||
15 | .file_title | 15 | .file_title |
16 | %i.icon-file | 16 | %i.icon-file |
17 | %span.file_name | 17 | %span.file_name |
18 | - = @tree.name | ||
19 | - %small= number_to_human_size @tree.size | ||
20 | - %span.options= render "tree/blob_actions" | 18 | + = @blob.name |
19 | + %small= number_to_human_size @blob.size | ||
20 | + %span.options= render "blob/actions" | ||
21 | .file_content.blame | 21 | .file_content.blame |
22 | %table | 22 | %table |
23 | - current_line = 1 | 23 | - current_line = 1 |
app/views/blob/_actions.html.haml
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | -# only show normal/blame view links for text files | 6 | -# only show normal/blame view links for text files |
7 | - if @blob.text? | 7 | - if @blob.text? |
8 | - if current_page? project_blame_path(@project, @id) | 8 | - if current_page? project_blame_path(@project, @id) |
9 | - = link_to "normal view", project_tree_path(@project, @id), class: "btn btn-tiny" | 9 | + = link_to "normal view", project_blob_path(@project, @id), class: "btn btn-tiny" |
10 | - else | 10 | - else |
11 | = link_to "blame", project_blame_path(@project, @id), class: "btn btn-tiny" | 11 | = link_to "blame", project_blame_path(@project, @id), class: "btn btn-tiny" |
12 | = link_to "history", project_commits_path(@project, @id), class: "btn btn-tiny" | 12 | = link_to "history", project_commits_path(@project, @id), class: "btn btn-tiny" |
app/workers/post_receive.rb
@@ -23,7 +23,7 @@ class PostReceive | @@ -23,7 +23,7 @@ class PostReceive | ||
23 | 23 | ||
24 | user = if identifier.blank? | 24 | user = if identifier.blank? |
25 | # Local push from gitlab | 25 | # Local push from gitlab |
26 | - email = project.repository.commit(newrev).author.email rescue nil | 26 | + email = project.repository.commit(newrev).author_email rescue nil |
27 | User.find_by_email(email) if email | 27 | User.find_by_email(email) if email |
28 | 28 | ||
29 | elsif identifier =~ /\Auser-\d+\Z/ | 29 | elsif identifier =~ /\Auser-\d+\Z/ |
features/steps/shared/paths.rb
@@ -205,7 +205,7 @@ module SharedPaths | @@ -205,7 +205,7 @@ module SharedPaths | ||
205 | end | 205 | end |
206 | 206 | ||
207 | Given 'I visit blob file from repo' do | 207 | Given 'I visit blob file from repo' do |
208 | - visit project_tree_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH)) | 208 | + visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH)) |
209 | end | 209 | end |
210 | 210 | ||
211 | Given 'I visit project source page for "8470d70"' do | 211 | Given 'I visit project source page for "8470d70"' do |
spec/factories.rb
@@ -86,9 +86,11 @@ FactoryGirl.define do | @@ -86,9 +86,11 @@ FactoryGirl.define do | ||
86 | target_branch "master" # pretend bcf03b5d~3 | 86 | target_branch "master" # pretend bcf03b5d~3 |
87 | source_branch "stable" # pretend bcf03b5d | 87 | source_branch "stable" # pretend bcf03b5d |
88 | st_commits do | 88 | st_commits do |
89 | - [Commit.new(project.repository.commit('bcf03b5d')), | ||
90 | - Commit.new(project.repository.commit('bcf03b5d~1')), | ||
91 | - Commit.new(project.repository.commit('bcf03b5d~2'))] | 89 | + [ |
90 | + project.repository.commit('bcf03b5d').to_hash, | ||
91 | + project.repository.commit('bcf03b5d~1').to_hash, | ||
92 | + project.repository.commit('bcf03b5d~2').to_hash | ||
93 | + ] | ||
92 | end | 94 | end |
93 | st_diffs do | 95 | st_diffs do |
94 | project.repo.diff("bcf03b5d~3", "bcf03b5d") | 96 | project.repo.diff("bcf03b5d~3", "bcf03b5d") |
spec/lib/git/commit_spec.rb
@@ -20,6 +20,8 @@ describe Gitlab::Git::Commit do | @@ -20,6 +20,8 @@ describe Gitlab::Git::Commit do | ||
20 | author: @author, | 20 | author: @author, |
21 | committer: @committer, | 21 | committer: @committer, |
22 | committed_date: Date.yesterday, | 22 | committed_date: Date.yesterday, |
23 | + authored_date: Date.yesterday, | ||
24 | + parents: [], | ||
23 | message: 'Refactoring specs' | 25 | message: 'Refactoring specs' |
24 | ) | 26 | ) |
25 | 27 |
spec/support/matchers.rb
@@ -3,7 +3,7 @@ RSpec::Matchers.define :be_valid_commit do | @@ -3,7 +3,7 @@ RSpec::Matchers.define :be_valid_commit do | ||
3 | actual != nil | 3 | actual != nil |
4 | actual.id == ValidCommit::ID | 4 | actual.id == ValidCommit::ID |
5 | actual.message == ValidCommit::MESSAGE | 5 | actual.message == ValidCommit::MESSAGE |
6 | - actual.author.name == ValidCommit::AUTHOR_FULL_NAME | 6 | + actual.author_name == ValidCommit::AUTHOR_FULL_NAME |
7 | end | 7 | end |
8 | end | 8 | end |
9 | 9 |