diff --git a/app/models/project.rb b/app/models/project.rb index 62f89e2cd1becbcc7f2aac6aead662e348fc3937..d98b53977053817208cb685352f1a997abe0465d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -444,6 +444,14 @@ class Project < ActiveRecord::Base # will be passed as post receive hook data. # push_commits_limited.each do |commit| + files, diffs = { added: [], removed: [], modified: [] }, commit.diffs + + diffs.each do |diff| + files[:added] << diff.new_path if diff.new_file + files[:removed] << diff.old_path if diff.deleted_file + files[:modified] << diff.new_path if !diff.new_file or !diff.deleted_file + end + data[:commits] << { id: commit.id, message: commit.safe_message, @@ -452,7 +460,10 @@ class Project < ActiveRecord::Base author: { name: commit.author_name, email: commit.author_email - } + }, + added: files[:added], + removed: files[:removed], + modified: files[:modified] } end diff --git a/app/views/hooks/_data_ex.html.erb b/app/views/hooks/_data_ex.html.erb index b4281fa18c7c36bf56ffdcbaa35e16e9a6c7c653..c3202bbe6da25463081b86034a0af56adf5fa6e1 100644 --- a/app/views/hooks/_data_ex.html.erb +++ b/app/views/hooks/_data_ex.html.erb @@ -9,7 +9,7 @@ "name": "Diaspora", "url": "git@localhost:diaspora.git", "description": "", - "homepage": "http://localhost/diaspora", + "homepage": "http://localhost/diaspora" }, "commits": [ { @@ -19,8 +19,11 @@ "url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", - "email": "jordi@softcatala.org", - } + "email": "jordi@softcatala.org" + }, + "added": ["app/assets/images/sadcat.jpg"], + "removed": ["lib/configuration.rb", "lib/configuration/methods.rb"], + "modified": [] }, // ... { @@ -30,12 +33,15 @@ "url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", - "email": "gitlabdev@dv6700.(none)", + "email": "gitlabdev@dv6700.(none)" }, - }, + "added": [], + "removed": [], + "modified": ["README.md"] + } ], - "total_commits_count": 4, -}; + "total_commits_count": 4 +} eos %>