Adding diff to Gitorious push notification emails

One thing we were really missing in

Gitorious is lack of diff in email notifications. We were using this feature in SVN for “quick code review”. Before we moved to Gitorious, we were using Gitolite where it was possible to configure it with git .hooks. However in Gitorious you do not have easy access to your repository directory ( it’s hashed ). So I have started googling about the feature. I have found in Gitorious a misterious feature called webhooks. But what it does is sending HTTP requests with JSON objects about commits, but without diff body. After loosing few more hours on google, forums and different groups I decided to try to implement this feature on my own. Few more hours to understand this mysterious ( for me ) Ruby on Rails code of Gitorious and I have localized few files that I should change to make it working. After all I have to say it was quite simple. The core are two lines that create commit diff in lib/event_rendering/text.rb:   repo = Repository.find_by_name_in_project!(event.target.name, event.project) diff_content = repo.git.git.show({}, [start_sha, end_sha].join(“..”))   (If you would like to modify content of the commit diff you just have to modify this git.git call ). Rest of the code is just for putting diff_content value into email :). You can review the whole patch here. After applying the patch please remember to restart git-poller and subscribe in Gitorious to email notification.

You May Also Like

Winter Agile Tuning Review

I've found Winter Agile Tuning conference purely by accident, reading someone's blog. I have to admit that I've never heard about it before event though it was a second edition already. As I had ma chance to talk with, Jakub Dziwisz, one of the organ... I've found Winter Agile Tuning conference purely by accident, reading someone's blog. I have to admit that I've never heard about it before event though it was a second edition already. As I had ma chance to talk with, Jakub Dziwisz, one of the organ...

WJUG o testach

„Spock, czyli czemu zrezygnowaliśmy z JUnita i Mockito” oraz „Geb” – to tematy, które przedstawili Jakub Nabradalik i Tomasz Kalkosiński z TouK podczas ostatniego (9.04) spotkania Warszawskiej Grupy Użytkowników Technologii Java (WJUG) poświęconego testowaniu. Kto nie słyszał chłopaków na żywo, może obejrzeć nagrane prezentacje.

SortedSet + Joda DateTime == danger

It's been quite a long time since I wrote something on this blog... Two things occurred that made me do this. Firstly, I'm going to talk at Java Developer's Conference in Cairo and at Booster conference in Bergen next month, so I want to have some co...