t/check-non-portable-shell: make error messages more compact
authorEric Sunshine <sunshine@sunshineco.com>
Fri, 13 Jul 2018 05:52:04 +0000 (01:52 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 21:55:01 +0000 (14:55 -0700)
Error messages emitted by this linting script are long and noisy,
consisting of several sections:

<test-script>:<line#>: error: <explanation>: <failed-shell-text>

The line of failed shell text, usually coming from within a test body,
is often indented by one or two TABs, with the result that the actual
(important) text is separated from <explanation> by a good deal of empty
space. This can make for a difficult read, especially on typical
80-column terminals.

Make the messages more compact and perhaps a bit easier to digest by
folding out the leading whitespace from <failed-shell-text>.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/check-non-portable-shell.pl
index 11028578ff27ac374853c500a6c9dccf69704144..f6dbe28b19c25e1828b4441754a8b2ffcbfd18ac 100755 (executable)
@@ -10,6 +10,8 @@
 
 sub err {
        my $msg = shift;
+       s/^\s+//;
+       s/\s+$//;
        print "$ARGV:$.: error: $msg: $_\n";
        $exit_code = 1;
 }