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
Jérome Perrin
gitlab-ce
Commits
c1174901
Commit
c1174901
authored
May 09, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deltas-only' into 'master'
Don't use DiffCollection for deltas See merge request !11201
parents
5354c293
3107f2e4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
6 deletions
+12
-6
app/models/commit.rb
app/models/commit.rb
+3
-1
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
app/workers/irker_worker.rb
app/workers/irker_worker.rb
+3
-3
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+4
-0
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+1
-1
No files found.
app/models/commit.rb
View file @
c1174901
...
...
@@ -336,6 +336,8 @@ class Commit
end
end
delegate
:deltas
,
to: :raw
,
prefix: :raw
def
diffs
(
diff_options
=
nil
)
Gitlab
::
Diff
::
FileCollection
::
Commit
.
new
(
self
,
diff_options:
diff_options
)
end
...
...
@@ -373,7 +375,7 @@ class Commit
def
repo_changes
changes
=
{
added:
[],
modified:
[],
removed:
[]
}
raw_d
iffs
(
deltas_only:
true
)
.
each
do
|
diff
|
raw_d
eltas
.
each
do
|
diff
|
if
diff
.
deleted_file
changes
[
:removed
]
<<
diff
.
old_path
elsif
diff
.
renamed_file
||
diff
.
new_file
...
...
app/services/git_push_service.rb
View file @
c1174901
...
...
@@ -67,7 +67,7 @@ class GitPushService < BaseService
paths
=
Set
.
new
@push_commits
.
each
do
|
commit
|
commit
.
raw_d
iffs
(
deltas_only:
true
)
.
each
do
|
diff
|
commit
.
raw_d
eltas
.
each
do
|
diff
|
paths
<<
diff
.
new_path
end
end
...
...
app/workers/irker_worker.rb
View file @
c1174901
...
...
@@ -142,10 +142,10 @@ class IrkerWorker
end
def
files_count
(
commit
)
diff
s
=
commit
.
raw_diffs
(
deltas_only:
true
)
diff
_size
=
commit
.
raw_deltas
.
size
files
=
"
#{
diff
s
.
real
_size
}
file"
files
+=
's'
if
diff
s
.
size
>
1
files
=
"
#{
diff_size
}
file"
files
+=
's'
if
diff
_
size
>
1
files
end
...
...
lib/gitlab/git/commit.rb
View file @
c1174901
...
...
@@ -192,6 +192,10 @@ module Gitlab
Commit
.
diff_from_parent
(
raw_commit
,
options
)
end
def
deltas
@deltas
||=
diff_from_parent
.
each_delta
.
map
{
|
d
|
Gitlab
::
Git
::
Diff
.
new
(
d
)
}
end
def
has_zero_stats?
stats
.
total
.
zero?
rescue
...
...
spec/services/git_push_service_spec.rb
View file @
c1174901
...
...
@@ -584,7 +584,7 @@ describe GitPushService, services: true do
commit
=
double
(
:commit
)
diff
=
double
(
:diff
,
new_path:
'README.md'
)
expect
(
commit
).
to
receive
(
:raw_d
iffs
).
with
(
deltas_only:
true
).
expect
(
commit
).
to
receive
(
:raw_d
eltas
).
and_return
([
diff
])
service
.
push_commits
=
[
commit
]
...
...
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