Skip to content

Commit b909a15

Browse files
Marco CostalbaJunio C Hamano
authored andcommitted
[PATCH] Fix git-commit-script to output on stderr when -v fails
When git-commit-script is called with -v option and verify test fails result is print on stdout instead of stderr. [jc: The original patch from Marco updated git-commit-script that still had the piece of code in question, which has been moved to an example hook script on its own, so I transplanted the patch to that new file instead.] Signed-off-by: Marco Costalba <mcostalba@yahoo.it> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 165e160 commit b909a15

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

templates/hooks--pre-commit

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ perl -e '
1919
sub bad_line {
2020
my ($why, $line) = @_;
2121
if (!$found_bad) {
22-
print "*\n";
23-
print "* You have some suspicious patch lines:\n";
24-
print "*\n";
22+
print STDERR "*\n";
23+
print STDERR "* You have some suspicious patch lines:\n";
24+
print STDERR "*\n";
2525
$found_bad = 1;
2626
}
2727
if ($reported_filename ne $filename) {
28-
print "* In $filename\n";
28+
print STDERR "* In $filename\n";
2929
$reported_filename = $filename;
3030
}
31-
print "* $why (line $lineno)\n";
32-
print "$filename:$lineno:$line\n";
31+
print STDERR "* $why (line $lineno)\n";
32+
print STDERR "$filename:$lineno:$line\n";
3333
}
3434
open $fh, "-|", qw(git-diff-cache -p -M --cached HEAD);
3535
while (<$fh>) {

0 commit comments

Comments
 (0)