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
15703c3f
Commit
15703c3f
authored
Sep 20, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed rubocop, and moved `delta_size_check` to its own EE only module.
parent
c22d40fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
22 deletions
+27
-22
lib/ee/gitlab/deltas.rb
lib/ee/gitlab/deltas.rb
+25
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+2
-22
No files found.
lib/ee/gitlab/deltas.rb
0 → 100644
View file @
15703c3f
module
EE
module
Gitlab
module
Deltas
def
self
.
delta_size_check
(
change
,
repo
)
size_of_deltas
=
0
begin
tree_a
=
repo
.
lookup
(
change
[
:oldrev
])
tree_b
=
repo
.
lookup
(
change
[
:newrev
])
diff
=
tree_a
.
diff
(
tree_b
)
diff
.
each_delta
do
|
d
|
new_file_size
=
d
.
deleted?
?
0
:
::
Gitlab
::
Git
::
Blob
.
raw
(
repo
,
d
.
new_file
[
:oid
]).
size
size_of_deltas
+=
new_file_size
end
size_of_deltas
rescue
Rugged
::
OdbError
,
Rugged
::
ReferenceError
,
Rugged
::
InvalidError
size_of_deltas
end
end
end
end
end
lib/gitlab/git_access.rb
View file @
15703c3f
...
...
@@ -126,7 +126,7 @@ module Gitlab
end
if
project
.
size_limit_enabled?
push_size_in_bytes
+=
delta_size_check
(
change
,
project
.
repository
)
push_size_in_bytes
+=
EE
::
Gitlab
::
Deltas
.
delta_size_check
(
change
,
project
.
repository
)
end
end
...
...
@@ -137,26 +137,6 @@ module Gitlab
build_status_object
(
true
)
end
def
delta_size_check
(
change
,
repo
)
size_of_deltas
=
0
begin
tree_a
=
repo
.
lookup
(
change
[
:oldrev
])
tree_b
=
repo
.
lookup
(
change
[
:newrev
])
diff
=
tree_a
.
diff
(
tree_b
)
diff
.
each_delta
do
|
d
|
new_file_size
=
d
.
deleted?
?
0
:
Gitlab
::
Git
::
Blob
.
raw
(
repo
,
d
.
new_file
[
:oid
]).
size
size_of_deltas
+=
new_file_size
end
size_of_deltas
rescue
Rugged
::
OdbError
,
Rugged
::
ReferenceError
,
Rugged
::
InvalidError
size_of_deltas
end
end
def
change_access_check
(
change
)
Checks
::
ChangeAccess
.
new
(
change
,
user_access:
user_access
,
project:
project
).
exec
end
...
...
@@ -281,4 +261,4 @@ module Gitlab
commit
.
refs
(
project
.
repository
).
any?
end
end
end
\ No newline at end of file
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