git-svn: reduce scope of input record separator change
Reducing the scope of where we change the record separator ($/) avoids bugs in calls which rely on the input record separator further down, such as the 'chomp' usage in command_oneline. This is necessary for a future change to git-svn, but exists in Git.pm since it seems useful for gitweb and our other Perl scripts, too. Signed-off-by: Eric Wong <e@80x24.org>
This commit is contained in:
16
perl/Git.pm
16
perl/Git.pm
@ -59,7 +59,7 @@ require Exporter;
|
||||
command_bidi_pipe command_close_bidi_pipe
|
||||
version exec_path html_path hash_object git_cmd_try
|
||||
remote_refs prompt
|
||||
get_tz_offset
|
||||
get_tz_offset get_record
|
||||
credential credential_read credential_write
|
||||
temp_acquire temp_is_locked temp_release temp_reset temp_path);
|
||||
|
||||
@ -538,6 +538,20 @@ sub get_tz_offset {
|
||||
return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
|
||||
}
|
||||
|
||||
=item get_record ( FILEHANDLE, INPUT_RECORD_SEPARATOR )
|
||||
|
||||
Read one record from FILEHANDLE delimited by INPUT_RECORD_SEPARATOR,
|
||||
removing any trailing INPUT_RECORD_SEPARATOR.
|
||||
|
||||
=cut
|
||||
|
||||
sub get_record {
|
||||
my ($fh, $rs) = @_;
|
||||
local $/ = $rs;
|
||||
my $rec = <$fh>;
|
||||
chomp $rec if defined $rs;
|
||||
$rec;
|
||||
}
|
||||
|
||||
=item prompt ( PROMPT , ISPASSWORD )
|
||||
|
||||
|
Reference in New Issue
Block a user