New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log2changes.pl: wrap long lines at 80 columns #9897
Conversation
Also, only use author names in the output. Fixes #9896 Reported-by: John Sherrill
my ($p, $msg)=@_; | ||
while(length($msg) > 77) { | ||
print $p.substr($msg, 0, 77, "")."\n"; | ||
$p=" "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid outputting lines with spaces-only (untested):
$o=substr($msg, 0, 77, "");
if $o ne "" {
$o=$p.$o;
}
print $o."\n";
Fixed earlier in fde1cb9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see them actually occurring? I tried this:
diff --git a/scripts/log2changes.pl b/scripts/log2changes.pl
index f4c06b750..fbaf177a9 100755
--- a/scripts/log2changes.pl
+++ b/scripts/log2changes.pl
@@ -41,11 +41,12 @@ sub printmsg {
my ($p, $msg)=@_;
while(length($msg) > 77) {
print $p.substr($msg, 0, 77, "")."\n";
$p=" ";
}
- print "$p$msg\n";
+ print "$p$msg\n" if($msg !~ /^\s+\z/);
+ print "HERE\n" if($msg =~ /^\s+\z/);
}
... but I don't see any HERE
output when I try this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why the test doesn't trigger, but the spaces are definitely there in the output:
Also, my patch was incomplete, here's one that fixes the above (and multiple issues with my untested patch):
--- log2changes-a.pl
+++ log2changes-b.pl
@@ -40,9 +40,16 @@
sub printmsg {
my ($p, $msg)=@_;
while(length($msg) > 77) {
- print $p.substr($msg, 0, 77, "")."\n";
+ $o=substr($msg, 0, 77, "");
+ if($o eq "") {
+ $p="";
+ }
+ print "$p$o\n";
$p=" ";
}
+ if($msg eq "") {
+ $p="";
+ }
print "$p$msg\n";
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I get it. I think it can be simplified to:
index f4c06b750..ee8a753eb 100755
--- a/scripts/log2changes.pl
+++ b/scripts/log2changes.pl
@@ -41,10 +41,13 @@ sub printmsg {
my ($p, $msg)=@_;
while(length($msg) > 77) {
print $p.substr($msg, 0, 77, "")."\n";
$p=" ";
}
+ if($msg eq "") {
+ $p = "";
+ }
print "$p$msg\n";
}
print
... since it it isn't likely that lines longer than 77 columns would return a "" (or even spaces-only) for those initial 77 columns.
Also, only use author names in the output.
Fixes #9896
Reported-by: John Sherrill