Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
f195a743
Commit
f195a743
authored
Jun 13, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RawBlame only called through Gitaly
Closes
https://gitlab.com/gitlab-org/gitaly/issues/376
parent
0e257722
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
26 deletions
+3
-26
lib/gitlab/git/blame.rb
lib/gitlab/git/blame.rb
+2
-17
spec/lib/gitlab/git/blame_spec.rb
spec/lib/gitlab/git/blame_spec.rb
+1
-9
No files found.
lib/gitlab/git/blame.rb
View file @
f195a743
...
@@ -22,24 +22,9 @@ module Gitlab
...
@@ -22,24 +22,9 @@ module Gitlab
private
private
def
load_blame
def
load_blame
raw_output
=
@repo
.
gitaly_migrate
(
:blame
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
is_enabled
|
output
=
encode_utf8
(
@repo
.
gitaly_commit_client
.
raw_blame
(
@sha
,
@path
))
if
is_enabled
load_blame_by_gitaly
else
load_blame_by_shelling_out
end
end
output
=
encode_utf8
(
raw_output
)
process_raw_blame
output
end
def
load_blame_by_gitaly
@repo
.
gitaly_commit_client
.
raw_blame
(
@sha
,
@path
)
end
def
load_blame_by_shelling_out
process_raw_blame
(
output
)
@repo
.
shell_blame
(
@sha
,
@path
)
end
end
def
process_raw_blame
(
output
)
def
process_raw_blame
(
output
)
...
...
spec/lib/gitlab/git/blame_spec.rb
View file @
f195a743
...
@@ -7,7 +7,7 @@ describe Gitlab::Git::Blame, seed_helper: true do
...
@@ -7,7 +7,7 @@ describe Gitlab::Git::Blame, seed_helper: true do
Gitlab
::
Git
::
Blame
.
new
(
repository
,
SeedRepo
::
Commit
::
ID
,
"CONTRIBUTING.md"
)
Gitlab
::
Git
::
Blame
.
new
(
repository
,
SeedRepo
::
Commit
::
ID
,
"CONTRIBUTING.md"
)
end
end
shared_examples
'blaming a file'
do
describe
'blaming a file'
do
context
"each count"
do
context
"each count"
do
it
do
it
do
data
=
[]
data
=
[]
...
@@ -68,12 +68,4 @@ describe Gitlab::Git::Blame, seed_helper: true do
...
@@ -68,12 +68,4 @@ describe Gitlab::Git::Blame, seed_helper: true do
end
end
end
end
end
end
context
'when Gitaly blame feature is enabled'
do
it_behaves_like
'blaming a file'
end
context
'when Gitaly blame feature is disabled'
,
:skip_gitaly_mock
do
it_behaves_like
'blaming a file'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment