[geany/infrastructure] a103f1: Show 'diff output truncated' notice only if the diff really was truncated

Enrico Tröger git-noreply at xxxxx
Mon Sep 17 21:34:40 UTC 2012


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Mon, 17 Sep 2012 21:34:40
Commit:      a103f17e5fbb2bd06f9e15327ba82f8ab0d014e8
             https://github.com/geany/infrastructure/commit/a103f17e5fbb2bd06f9e15327ba82f8ab0d014e8

Log Message:
-----------
Show 'diff output truncated' notice only if the diff really was truncated

I'm pretty much sure len() on strings and unicode objects is implemented in
a fast way, not by just counting every character so this should be ok.


Modified Paths:
--------------
    scripts/git_hooks/github_commit_mail.py

Modified: scripts/git_hooks/github_commit_mail.py
5 files changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -214,8 +214,9 @@ def _generate_modified_files_diffs(self, full_commit_info):
                               patch=self._get_diff_if_available(modified_file))
             diffs += EMAIL_DIFF_TEMPLATE % parameters
         # shrink diffs to at most ~ 100KB
-        diffs = diffs[:100000]
-        diffs += u'@@ Diff output truncated at 100000 characters. @@\n\n'
+        if len(diffs) > 100000:
+            diffs = diffs[:100000]
+            diffs += u'@@ Diff output truncated at 100000 characters. @@\n'
         return diffs
 
     #----------------------------------------------------------------------


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list