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
58bfcb0a
Commit
58bfcb0a
authored
Aug 03, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use raw_diffs for internal git diff
See
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5401
parent
0c33c08e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
lib/gitlab/authority_analyzer.rb
lib/gitlab/authority_analyzer.rb
+1
-1
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+3
-3
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+2
-2
spec/lib/gitlab/authority_analyzer_spec.rb
spec/lib/gitlab/authority_analyzer_spec.rb
+1
-1
No files found.
lib/gitlab/authority_analyzer.rb
View file @
58bfcb0a
...
...
@@ -32,7 +32,7 @@ module Gitlab
diffable
=
[
@merge_request
.
compare
,
@merge_request
.
merge_request_diff
].
compact
return
[]
if
diffable
.
empty?
compare_diffs
=
diffable
.
first
.
diffs
compare_diffs
=
diffable
.
first
.
raw_
diffs
return
[]
unless
compare_diffs
.
present?
...
...
lib/gitlab/checks/change_access.rb
View file @
58bfcb0a
...
...
@@ -143,7 +143,7 @@ module Gitlab
commits
(
@oldrev
).
each
do
|
commit
|
next
if
commit_from_annex_sync?
(
commit
.
safe_message
)
commit
.
diffs
.
each
do
|
diff
|
commit
.
raw_
diffs
.
each
do
|
diff
|
path
=
diff
.
new_path
||
diff
.
old_path
lock_info
=
project
.
find_path_lock
(
path
)
...
...
@@ -195,7 +195,7 @@ module Gitlab
def
check_commit_diff
(
commit
,
push_rule
)
if
push_rule
.
file_name_regex
.
present?
commit
.
diffs
.
each
do
|
diff
|
commit
.
raw_
diffs
.
each
do
|
diff
|
if
(
diff
.
renamed_file
||
diff
.
new_file
)
&&
diff
.
new_path
=~
Regexp
.
new
(
push_rule
.
file_name_regex
)
return
"File name
#{
diff
.
new_path
.
inspect
}
is prohibited by the pattern '
#{
push_rule
.
file_name_regex
}
'"
end
...
...
@@ -203,7 +203,7 @@ module Gitlab
end
if
push_rule
.
max_file_size
>
0
commit
.
diffs
.
each
do
|
diff
|
commit
.
raw_
diffs
.
each
do
|
diff
|
next
if
diff
.
deleted_file
blob
=
project
.
repository
.
blob_at
(
commit
.
id
,
diff
.
new_path
)
...
...
lib/gitlab/git_access.rb
View file @
58bfcb0a
...
...
@@ -170,7 +170,7 @@ module Gitlab
def
check_commit_diff
(
commit
,
push_rule
)
if
push_rule
.
file_name_regex
.
present?
commit
.
diffs
.
each
do
|
diff
|
commit
.
raw_
diffs
.
each
do
|
diff
|
if
(
diff
.
renamed_file
||
diff
.
new_file
)
&&
diff
.
new_path
=~
Regexp
.
new
(
push_rule
.
file_name_regex
)
return
build_status_object
(
false
,
"File name
#{
diff
.
new_path
.
inspect
}
is prohibited by the pattern '
#{
push_rule
.
file_name_regex
}
'"
)
end
...
...
@@ -178,7 +178,7 @@ module Gitlab
end
if
push_rule
.
max_file_size
>
0
commit
.
diffs
.
each
do
|
diff
|
commit
.
raw_
diffs
.
each
do
|
diff
|
next
if
diff
.
deleted_file
blob
=
project
.
repository
.
blob_at
(
commit
.
id
,
diff
.
new_path
)
...
...
spec/lib/gitlab/authority_analyzer_spec.rb
View file @
58bfcb0a
...
...
@@ -22,7 +22,7 @@ describe Gitlab::AuthorityAnalyzer, lib: true do
let
(
:approvers
)
{
Gitlab
::
AuthorityAnalyzer
.
new
(
merge_request
).
calculate
(
number_of_approvers
)
}
before
do
merge_request
.
compare
=
double
(
:compare
,
diffs:
files
)
merge_request
.
compare
=
double
(
:compare
,
raw_
diffs:
files
)
allow
(
merge_request
.
target_project
.
repository
).
to
receive
(
:commits
).
and_return
(
commits
)
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