<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,6 +10,8 @@ Setup and configuration are done entirely inside your deploy.rb file to keep it
 
 This even includes the Net::SMTP TLS hack inside as a vendored dependancy to allow super easy email sending without setting up an MTA.
 
+This was extended a bit to support inclusion a list of Git commits that were deployed to the server in the email. Read CONFIG section for more information.
+
 == CONFIG
 
 In your Capistrano config file (usually deploy.rb):
@@ -29,9 +31,15 @@ In your Capistrano config file (usually deploy.rb):
     # define the options for the actual emails that go out -- :recipients is the only required option
     set :cap_gun_email_envelope, { :recipients =&gt; %w[joe@example.com, jane@example.com] }
     
-    # register email as a callback after restart
-    after &quot;deploy:restart&quot;, &quot;cap_gun:email&quot;
+    # add these settings if you use Git and  want to display a list of changes that were deployed to the server
+    set :cap_gun_include_pending_changes, true
     
+    # if you don't have this setting, we will just put hash instead of URL to github
+    set :cap_gun_view_git_commit_url,    &quot;https://github.com/wildbit/beanstalk/commit/%s&quot;
+
+    # people who have capistrano settings with tasks should tweak this.
+    set :cap_gun_pending_cmd,            &quot;cap #{ARGV.first} deploy:pending&quot;
+            
     # Test everything out by running &quot;cap cap_gun:email&quot;
 
 == USAGE</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -125,6 +125,11 @@ module CapGun
 
 Comment: #{capistrano[:comment] || &quot;[none given]&quot;}
 
+#{ 
+  unless capistrano[:pending_changes].blank? 
+      &quot;\nDeployed changes\n================\n&quot; + capistrano[:pending_changes].to_s 
+  end 
+}
 Nerd details
 ============
 Release: #{capistrano[:current_release]}
@@ -147,13 +152,45 @@ if Object.const_defined?(&quot;Capistrano&quot;)
 
   Capistrano::Configuration.instance(:must_exist).load do
 
+    before &quot;deploy:update_code&quot;, &quot;cap_gun:gather_pending_changes&quot;
+    after  &quot;deploy:restart&quot;,     &quot;cap_gun:email&quot;
+    
     namespace :cap_gun do
       desc &quot;Send notification of the current release and the previous release via email.&quot;
       task :email do
         CapGun::Helper.load_mailer_config(self)
         CapGun::Mailer.deliver_deployment_notification(self)
       end
+      
+      def shorten_string(msg, limit=100)
+        msg = msg.to_s
+        if msg.size &lt; limit
+          msg
+        else
+          msg.to_s[0,limit-1] + &quot;...&quot;
+        end
+      end
+
+      def view_git_commit_url(hash)
+        if self[:cap_gun_view_git_commit_url]
+          self[:cap_gun_view_git_commit_url] % hash
+        else
+          hash
+        end
+      end
+      
+      desc &quot;Gather information about pending changes (should be ran before the deployment completed)&quot;
+      task :gather_pending_changes do
+        next unless self[:cap_gun_include_pending_changes]
+        changes = String.new
+        raw = `#{self[:cap_gun_pending_cmd] || &quot;cap deploy:pending&quot;}`
+        raw.scan(/commit (\w{40}).+?Author: (.+?) &lt;.+?&gt;\nDate: .+?\n\s+(.+?)\n/m).each { |(hash, author, message)|
+          next if message =~ /Merge branch/
+          changes &lt;&lt; &quot;* #{shorten_string(message)}\n#{view_git_commit_url(hash)} [#{author}]\n\n&quot;
+        }
+        set(:pending_changes, changes)        
+      end
     end
     
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/cap_gun.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>000566ce5713d6b0ad88b1ff83f24b35444db0d8</id>
    </parent>
  </parents>
  <author>
    <name>Dima Sabanin</name>
    <email>sdmitry@gmail.com</email>
  </author>
  <url>http://github.com/railsmonk/cap_gun/commit/2a52aefffcf6c362df99823762b09c262b15fffd</url>
  <id>2a52aefffcf6c362df99823762b09c262b15fffd</id>
  <committed-date>2009-03-18T10:57:38-07:00</committed-date>
  <authored-date>2009-03-18T10:57:38-07:00</authored-date>
  <message>Add information about Git commits that were deployed on server into deployment notification email.</message>
  <tree>08e354e2d71a86162391f3210cac39b1c842cc58</tree>
  <committer>
    <name>Dima Sabanin</name>
    <email>sdmitry@gmail.com</email>
  </committer>
</commit>
