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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
48254d18
Commit
48254d18
authored
May 09, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use DiffCollection for deltas
parent
62b0eb2c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
6 deletions
+14
-6
app/models/commit.rb
app/models/commit.rb
+5
-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 @
48254d18
...
...
@@ -373,7 +373,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
...
...
@@ -386,6 +386,10 @@ class Commit
changes
end
def
raw_deltas
raw
.
deltas
end
def
merged_merge_request?
(
user
)
!!
merged_merge_request
(
user
)
end
...
...
app/services/git_push_service.rb
View file @
48254d18
...
...
@@ -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 @
48254d18
...
...
@@ -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 @
48254d18
...
...
@@ -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 @
48254d18
...
...
@@ -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