file diffs in the message body

Issue #11 wontfix
Adam Horner created an issue

Is it possible to get a diff inline in the email for each changed file? That way there is no need to be online to review the commits, a feature we would like.

If the answer is that it can't be done in the current codebase, we will look to implement and issue a pull request, but some tips/pointers on where/how to implement this would be much appreciated.

Thanks, Adam.

Comments (1)

  1. Marc Vanbrabant repo owner

    Hi Adam,

    Yes this can be done, but it will require some extra java and velocity coding.

    You will have to call a git diff command (grabbing the output from GitStringOutputHandler) for every change in the ChangeSet. Just have a look at how GitStringOutputHandler is used now to execute arbitrary git commands. After you have the result you can mangle the diff to colorize additions and deletions.

    However, the reason I have not implemented are these: * More people work online nowadays, I see very little use in having offline mail diffs (especially with git merges, with this your mailbox will explode) * You will be executing a lot of git diff commands (especially with git merges), so performance will impacted, mailserver wise as well as git daemon wise * I wanted notifier to be quick. Generating the diffs will only slow it down, which is why I have linked it to the stash interface

    If you're still not convinced, you can implement the API functions in SmtpNotificationRenderer to provide diffs in the templates and provide an example template which does this. Note that I won't include it in the default template.

    If you need more pointers, DM me.

  2. Log in to comment