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

Context menu or Action buttons ?

Recently I was drawn into one of those UI "religious" disputes that has no easy answers and usually both sides are right. One of our web developers was trying out new web tech (with pretty rich widget library) and started to question himself about some basic usability decisions. The low level problem in this case is usually brought to "which widget should I use ?". I'm not fond of bringing the usability problems to questions: Should I use Tabs over Menu ? Or should I use Context menu instead of buttons panel ? But sometimes if time is crucial factor and other usability levels are by default not addressed at all - better developer that asks those basic questions than developer that do not question himself at all.