summaryrefslogtreecommitdiff
path: root/lib/gitlab/git_post_receive.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git_post_receive.rb')
-rw-r--r--lib/gitlab/git_post_receive.rb33
1 files changed, 10 insertions, 23 deletions
diff --git a/lib/gitlab/git_post_receive.rb b/lib/gitlab/git_post_receive.rb
index 6babea144c7..742118b76a8 100644
--- a/lib/gitlab/git_post_receive.rb
+++ b/lib/gitlab/git_post_receive.rb
@@ -1,43 +1,30 @@
module Gitlab
class GitPostReceive
include Gitlab::Identifier
- attr_reader :repo_path, :identifier, :changes, :project
+ attr_reader :project, :identifier, :changes
- def initialize(repo_path, identifier, changes)
- repo_path.gsub!(/\.git\z/, '')
- repo_path.gsub!(/\A\//, '')
-
- @repo_path = repo_path
+ def initialize(project, identifier, changes)
+ @project = project
@identifier = identifier
@changes = deserialize_changes(changes)
-
- retrieve_project_and_type
- end
-
- def wiki?
- @type == :wiki
- end
-
- def regular_project?
- @type == :project
end
def identify(revision)
super(identifier, project, revision)
end
- private
+ def changes_refs
+ return enum_for(:changes_refs) unless block_given?
- def retrieve_project_and_type
- @type = :project
- @project = Project.find_by_full_path(@repo_path)
+ changes.each do |change|
+ oldrev, newrev, ref = change.strip.split(' ')
- if @repo_path.end_with?('.wiki') && !@project
- @type = :wiki
- @project = Project.find_by_full_path(@repo_path.gsub(/\.wiki\z/, ''))
+ yield oldrev, newrev, ref
end
end
+ private
+
def deserialize_changes(changes)
changes = utf8_encode_changes(changes)
changes.lines