ossp-pkg/shiela/shiela.pl 1.32 -> 1.33
--- shiela.pl 2002/12/22 15:04:00 1.32
+++ shiela.pl 2002/12/22 16:30:14 1.33
@@ -979,6 +979,41 @@
## _________________________________________________________________
##
+## Wrap a single-line log message.
+##
+## This line-wraps a single-line log message into a multi-line log
+## message.
+## _________________________________________________________________
+##
+
+sub wrap_message {
+ my ($columns, $text) = @_;
+
+ my $r = "";
+ my $nl = "";
+ my $left = "";
+ pos($text) = 0;
+
+ while ($text !~ m/\G\s*\Z/gc) {
+ if ($text =~ /\G([^\n]{0,$columns})(\s|\z)/xmgc) {
+ $r .= $nl . $1;
+ $left = $2;
+ } elsif ($text =~ /\G([^\n]*?)(\s|\z)/xmgc) {
+ $r .= $nl . $1;
+ $left = $2;
+ }
+ $nl = "\n";
+ }
+
+ $r .= $left;
+ $r .= substr($text, pos($text), length($text)-pos($text))
+ if (pos($text) ne length($text));
+
+ return $r;
+}
+
+## _________________________________________________________________
+##
## TAGINFO HOOK
##
## We hook into CVS via `taginfo' to check whether user is allowed to
@@ -2135,7 +2170,10 @@
$O .= "\n";
$O .= $prefix."Log:\n";
my $log = $IN->{log};
- $log =~ s|^|$prefix |mg;
+ if ($log !~ m|\n.+|s and length($log) > 70) {
+ $log = &wrap_message(70, $log);
+ }
+ $log =~ s|^|${prefix} |mg;
$O .= $log;
}
|
|