Commit 52aee4f5b557052678e805dd4d884dbc815d70e0

Use only the master"s commits to create events

Signed-off-by: David A. Cuadrado <krawek@gmail.com>

Commit diff

data/hooks/post-receive

 
6666 # type => heads, tags, remotes
6767 # name => branch name
6868 path, type, name = revname.split("/")
69
7069 revs = [ current_rev ]
71 if type == "heads" && action == :update
72 revs = git.rev_list({}, "#{oldrev}..#{newrev}").split("\n")
73 emails = git.log({:pretty => "format:%ce"}, "#{oldrev}..#{newrev}").split("\n")
74 else
75 emails = [git.show({:pretty => "format:%ce", :s => true}, current_rev)]
70 emails = [git.show({:pretty => "format:%ce", :s => true}, current_rev)]
71
72 if type == "heads"
73 if action == :update
74 revs = git.rev_list({}, "#{oldrev}..#{newrev}").split("\n")
75 emails = git.log({:pretty => "format:%ce"}, "#{oldrev}..#{newrev}").split("\n")
76 elsif action == :create && name == "master"
77 revs = git.rev_list({}, current_rev).split("\n")
78 emails = git.log({:pretty => "format:%ce"}, current_rev).split("\n")
79 end
7680 end
7781
7882 users = User.find(:all, :conditions => ["email in (?)", emails])
117117 ref = name
118118 when :update
119119 action_id = Action::COMMIT
120 ref = current_rev
120 ref = sha1
121121 when :delete
122122 action_id = Action::DELETE_BRANCH
123123 ref = name
149149 # puts " #{hash[:message]}"
150150
151151 project.create_event(action_id, repository, user, ref, hash[:message], hash[:date])
152 action = :update
152153 end
153154end
154155
toggle raw diff