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
Léo-Paul Géneau
gitlab-ce
Commits
2ac67228
Commit
2ac67228
authored
Jun 21, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raw changes calculation is Gitaly only now
Closes
https://gitlab.com/gitlab-org/gitaly/issues/1138
parent
7c11ed8c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
54 deletions
+29
-54
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+4
-19
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+25
-35
No files found.
lib/gitlab/git/repository.rb
View file @
2ac67228
...
@@ -529,30 +529,15 @@ module Gitlab
...
@@ -529,30 +529,15 @@ module Gitlab
def
raw_changes_between
(
old_rev
,
new_rev
)
def
raw_changes_between
(
old_rev
,
new_rev
)
@raw_changes_between
||=
{}
@raw_changes_between
||=
{}
@raw_changes_between
[[
old_rev
,
new_rev
]]
||=
begin
@raw_changes_between
[[
old_rev
,
new_rev
]]
||=
begin
return
[]
if
new_rev
.
blank?
||
new_rev
==
Gitlab
::
Git
::
BLANK_SHA
return
[]
if
new_rev
.
blank?
||
new_rev
==
Gitlab
::
Git
::
BLANK_SHA
gitaly_migrate
(
:raw_changes_between
)
do
|
is_enabled
|
wrapped_gitaly_errors
do
if
is_enabled
gitaly_repository_client
.
raw_changes_between
(
old_rev
,
new_rev
)
gitaly_repository_client
.
raw_changes_between
(
old_rev
,
new_rev
)
.
each_with_object
([])
do
|
msg
,
arr
|
.
each_with_object
([])
do
|
msg
,
arr
|
msg
.
raw_changes
.
each
{
|
change
|
arr
<<
::
Gitlab
::
Git
::
RawDiffChange
.
new
(
change
)
}
msg
.
raw_changes
.
each
{
|
change
|
arr
<<
::
Gitlab
::
Git
::
RawDiffChange
.
new
(
change
)
}
end
end
else
result
=
[]
circuit_breaker
.
perform
do
Open3
.
pipeline_r
(
git_diff_cmd
(
old_rev
,
new_rev
),
format_git_cat_file_script
,
git_cat_file_cmd
)
do
|
last_stdout
,
wait_threads
|
last_stdout
.
each_line
{
|
line
|
result
<<
::
Gitlab
::
Git
::
RawDiffChange
.
new
(
line
.
chomp!
)
}
if
wait_threads
.
any?
{
|
waiter
|
!
waiter
.
value
&
.
success?
}
raise
::
Gitlab
::
Git
::
Repository
::
GitError
,
"Unabled to obtain changes between
#{
old_rev
}
and
#{
new_rev
}
"
end
end
end
result
end
end
end
end
end
rescue
ArgumentError
=>
e
rescue
ArgumentError
=>
e
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
2ac67228
...
@@ -1043,7 +1043,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -1043,7 +1043,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
describe
'#raw_changes_between'
do
describe
'#raw_changes_between'
do
shared_examples
'raw changes'
do
let
(
:old_rev
)
{
}
let
(
:old_rev
)
{
}
let
(
:new_rev
)
{
}
let
(
:new_rev
)
{
}
let
(
:changes
)
{
repository
.
raw_changes_between
(
old_rev
,
new_rev
)
}
let
(
:changes
)
{
repository
.
raw_changes_between
(
old_rev
,
new_rev
)
}
...
@@ -1081,15 +1080,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -1081,15 +1080,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
end
end
context
'when gitaly is enabled'
do
it_behaves_like
'raw changes'
end
context
'when gitaly is disabled'
,
:disable_gitaly
do
it_behaves_like
'raw changes'
end
end
describe
'#merge_base'
do
describe
'#merge_base'
do
shared_examples
'#merge_base'
do
shared_examples
'#merge_base'
do
where
(
:from
,
:to
,
:result
)
do
where
(
:from
,
:to
,
:result
)
do
...
...
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