Add subroutines prefix_lines and comment_lines. Signed-off-by: Vasco Almeida <vascomalme...@sapo.pt> --- perl/Git.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/perl/Git.pm b/perl/Git.pm index b2732822a..69cd1ddec 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -1438,6 +1438,30 @@ sub END { } # %TEMP_* Lexical Context +=item prefix_lines ( PREFIX, STRING [, STRING... ]) + +Prefixes lines in C<STRING> with C<PREFIX>. + +=cut + +sub prefix_lines { + my $prefix = shift; + my $string = join("\n", @_); + $string =~ s/^/$prefix/mg; + return $string; +} + +=item comment_lines ( STRING [, STRING... ]) + +Comments lines following core.commentchar configuration. + +=cut + +sub comment_lines { + my $comment_line_char = config("core.commentchar") || '#'; + return prefix_lines("$comment_line_char ", @_); +} + =back =head1 ERROR HANDLING -- 2.11.0.rc0.33.gec17dab