Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-12-07 17:43:13 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-12-07 22:31:49 +0300
commite70ac793a2c0ca587627997394713599c0aba4ef (patch)
tree3a15ee9eee6db178644f4cf3d554dab61198045f /lib
parent46d24898eda68887299d6db0f0fa40d660f79412 (diff)
Merge branch 'webhook_payload_with_changes' into 'master'
Add added, modified and removed properties to commit object in webhook https://gitlab.com/gitlab-org/gitlab-ee/issues/20 See merge request !1988
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/push_data_builder.rb36
1 files changed, 5 insertions, 31 deletions
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb
index fa068d50763..4f9cdef3869 100644
--- a/lib/gitlab/push_data_builder.rb
+++ b/lib/gitlab/push_data_builder.rb
@@ -18,10 +18,7 @@ module Gitlab
# homepage: String,
# },
# commits: Array,
- # total_commits_count: Fixnum,
- # added: ["CHANGELOG"],
- # modified: [],
- # removed: ["tmp/file.txt"]
+ # total_commits_count: Fixnum
# }
#
def build(project, user, oldrev, newrev, ref, commits = [], message = nil)
@@ -33,11 +30,12 @@ module Gitlab
# For performance purposes maximum 20 latest commits
# will be passed as post receive hook data.
- commit_attrs = commits_limited.map(&:hook_attrs)
+ commit_attrs = commits_limited.map do |commit|
+ commit.hook_attrs(with_changed_files: true)
+ end
type = Gitlab::Git.tag_ref?(ref) ? "tag_push" : "push"
- repo_changes = repo_changes(project, newrev, oldrev)
# Hash to be passed as post_receive_data
data = {
object_kind: type,
@@ -60,10 +58,7 @@ module Gitlab
visibility_level: project.visibility_level
},
commits: commit_attrs,
- total_commits_count: commits_count,
- added: repo_changes[:added],
- modified: repo_changes[:modified],
- removed: repo_changes[:removed]
+ total_commits_count: commits_count
}
data
@@ -94,27 +89,6 @@ module Gitlab
newrev
end
end
-
- def repo_changes(project, newrev, oldrev)
- changes = { added: [], modified: [], removed: [] }
- compare_result = CompareService.new.
- execute(project, newrev, project, oldrev)
-
- if compare_result
- compare_result.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
- end
- end
-
- changes
- end
end
end
end