diff options
-rwxr-xr-x | tools/git-notify | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/git-notify b/tools/git-notify index 9ab012e..39abd66 100755 --- a/tools/git-notify +++ b/tools/git-notify | |||
@@ -127,6 +127,20 @@ sub git_rev_list(@) | |||
127 | return $revlist; | 127 | return $revlist; |
128 | } | 128 | } |
129 | 129 | ||
130 | # truncate the given string if it exceeds the specified number of characters | ||
131 | sub truncate_str($$) | ||
132 | { | ||
133 | my ($str, $max) = @_; | ||
134 | |||
135 | if (length($str) > $max) | ||
136 | { | ||
137 | $str = substr($str, 0, $max); | ||
138 | $str =~ s/\s+\S+$//; | ||
139 | $str .= " ..."; | ||
140 | } | ||
141 | return $str; | ||
142 | } | ||
143 | |||
130 | # right-justify the left column of "left: right" elements, omit undefined elements | 144 | # right-justify the left column of "left: right" elements, omit undefined elements |
131 | sub format_table(@) | 145 | sub format_table(@) |
132 | { | 146 | { |
@@ -338,7 +352,7 @@ sub send_commit_notice($$) | |||
338 | } | 352 | } |
339 | 353 | ||
340 | mail_notification($commitlist_address, | 354 | mail_notification($commitlist_address, |
341 | $info{"author_name"} . ": " . ${$info{"log"}}[0], | 355 | $info{"author_name"} . ": " . truncate_str(${$info{"log"}}[0], 50), |
342 | "text/plain; charset=UTF-8", @notice); | 356 | "text/plain; charset=UTF-8", @notice); |
343 | $sent_notices++; | 357 | $sent_notices++; |
344 | } | 358 | } |