BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3c97cbc7
Commit
3c97cbc7
authored
Dec 07, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes after review
parent
5df2c441
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
18 deletions
+11
-18
commit.rb
app/models/commit.rb
+9
-16
push_data_builder.rb
lib/gitlab/push_data_builder.rb
+1
-1
commit_spec.rb
spec/models/commit_spec.rb
+1
-1
No files found.
app/models/commit.rb
View file @
3c97cbc7
...
...
@@ -135,7 +135,7 @@ class Commit
description
.
present?
end
def
hook_attrs
(
with_changed_files
=
false
)
def
hook_attrs
(
with_changed_files
:
false
)
path_with_namespace
=
project
.
path_with_namespace
data
=
{
...
...
@@ -150,11 +150,7 @@ class Commit
}
if
with_changed_files
data
.
merge!
({
added:
repo_changes
[
:added
],
modified:
repo_changes
[
:modified
],
removed:
repo_changes
[
:removed
]
})
data
.
merge!
(
repo_changes
)
end
data
...
...
@@ -212,16 +208,13 @@ class Commit
def
repo_changes
changes
=
{
added:
[],
modified:
[],
removed:
[]
}
if
diffs
.
any?
diffs
.
each
do
|
diff
|
case
true
when
diff
.
deleted_file
changes
[
:removed
]
<<
diff
.
old_path
when
diff
.
renamed_file
,
diff
.
new_file
changes
[
:added
]
<<
diff
.
new_path
else
changes
[
:modified
]
<<
diff
.
new_path
end
diffs
.
each
do
|
diff
|
if
diff
.
deleted_file
changes
[
:removed
]
<<
diff
.
old_path
elsif
diff
.
renamed_file
||
diff
.
new_file
changes
[
:added
]
<<
diff
.
new_path
else
changes
[
:modified
]
<<
diff
.
new_path
end
end
...
...
lib/gitlab/push_data_builder.rb
View file @
3c97cbc7
...
...
@@ -31,7 +31,7 @@ module Gitlab
# For performance purposes maximum 20 latest commits
# will be passed as post receive hook data.
commit_attrs
=
commits_limited
.
map
do
|
commit
|
commit
.
hook_attrs
(
true
)
commit
.
hook_attrs
(
with_changed_files:
true
)
end
type
=
Gitlab
::
Git
.
tag_ref?
(
ref
)
?
"tag_push"
:
"push"
...
...
spec/models/commit_spec.rb
View file @
3c97cbc7
...
...
@@ -102,7 +102,7 @@ eos
end
describe
'#hook_attrs'
do
let
(
:data
)
{
commit
.
hook_attrs
(
true
)
}
let
(
:data
)
{
commit
.
hook_attrs
(
with_changed_files:
true
)
}
it
{
expect
(
data
).
to
be_a
(
Hash
)
}
it
{
expect
(
data
[
:message
]).
to
include
(
'Add submodule from gitlab.com'
)
}
...
...
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