summaryrefslogtreecommitdiff
path: root/perl/Git.pm
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-12-27 08:11:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-27 08:11:40 (GMT)
commit1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac (patch)
tree943d4c5dd8f366e610f08ce92fcb5d76291d72f0 /perl/Git.pm
parent95d0367b2e397080d37c4b82dbd2ba10ffa262dc (diff)
parenta948ebacbf0debd5129f4f528229183c97ff90b1 (diff)
downloadgit-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.zip
git-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.tar.gz
git-1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac.tar.bz2
Merge branch 'va/i18n-perl-scripts'
Porcelain scripts written in Perl are getting internationalized. * va/i18n-perl-scripts: i18n: difftool: mark warnings for translation i18n: send-email: mark composing message for translation i18n: send-email: mark string with interpolation for translation i18n: send-email: mark warnings and errors for translation i18n: send-email: mark strings for translation i18n: add--interactive: mark status words for translation i18n: add--interactive: remove %patch_modes entries i18n: add--interactive: mark edit_hunk_manually message for translation i18n: add--interactive: i18n of help_patch_cmd i18n: add--interactive: mark patch prompt for translation i18n: add--interactive: mark plural strings i18n: clean.c: match string with git-add--interactive.perl i18n: add--interactive: mark strings with interpolation for translation i18n: add--interactive: mark simple here-documents for translation i18n: add--interactive: mark strings for translation Git.pm: add subroutines for commenting lines
Diffstat (limited to 'perl/Git.pm')
-rw-r--r--perl/Git.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index b273282..bfce1f7 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1438,6 +1438,44 @@ 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 get_comment_line_char ( )
+
+Gets the core.commentchar configuration value.
+The value falls-back to '#' if core.commentchar is set to 'auto'.
+
+=cut
+
+sub get_comment_line_char {
+ my $comment_line_char = config("core.commentchar") || '#';
+ $comment_line_char = '#' if ($comment_line_char eq 'auto');
+ $comment_line_char = '#' if (length($comment_line_char) != 1);
+ return $comment_line_char;
+}
+
+=item comment_lines ( STRING [, STRING... ])
+
+Comments lines following core.commentchar configuration.
+
+=cut
+
+sub comment_lines {
+ my $comment_line_char = get_comment_line_char;
+ return prefix_lines("$comment_line_char ", @_);
+}
+
=back
=head1 ERROR HANDLING