Skip to content

Commit 2e7ca27

Browse files
committed
Merge branch 'ew/svn-maint-fixes' into maint
Correct a breakage to git-svn around v2.2 era that triggers premature closing of FileHandle. * ew/svn-maint-fixes: Git::SVN::*: avoid premature FileHandle closure git-svn: fix localtime=true on non-glibc environments
2 parents e1db59e + e426311 commit 2e7ca27

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

perl/Git/SVN.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use IPC::Open3;
1414
use Memoize; # core since 5.8.0, Jul 2002
1515
use Memoize::Storable;
1616
use POSIX qw(:signal_h);
17+
use Time::Local;
1718

1819
use Git qw(
1920
command
@@ -1332,7 +1333,7 @@ sub parse_svn_date {
13321333
$ENV{TZ} = 'UTC';
13331334

13341335
my $epoch_in_UTC =
1335-
POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);
1336+
Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);
13361337

13371338
# Determine our local timezone (including DST) at the
13381339
# time of $epoch_in_UTC. $Git::SVN::Log::TZ stored the

perl/Git/SVN/Fetcher.pm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ sub apply_textdelta {
322322
# (but $base does not,) so dup() it for reading in close_file
323323
open my $dup, '<&', $fh or croak $!;
324324
my $base = $::_repository->temp_acquire("git_blob_${$}_$suffix");
325+
# close_file may call temp_acquire on 'svn_hash', but because of the
326+
# call chain, if the temp_acquire call from close_file ends up being the
327+
# call that first creates the 'svn_hash' temp file, then the FileHandle
328+
# that's created as a result will end up in an SVN::Pool that we clear
329+
# in SVN::Ra::gs_fetch_loop_common. Avoid that by making sure the
330+
# 'svn_hash' FileHandle is already created before close_file is called.
331+
my $tmp_fh = $::_repository->temp_acquire('svn_hash');
332+
$::_repository->temp_release($tmp_fh, 1);
325333

326334
if ($fb->{blob}) {
327335
my ($base_is_link, $size);

perl/Git/SVN/Ra.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ sub longest_common_path {
391391
sub gs_fetch_loop_common {
392392
my ($self, $base, $head, $gsv, $globs) = @_;
393393
return if ($base > $head);
394+
# Make sure the cat_blob open2 FileHandle is created before calling
395+
# SVN::Pool::new_default so that it does not incorrectly end up in the pool.
396+
$::_repository->_open_cat_blob_if_needed;
394397
my $gpool = SVN::Pool->new_default;
395398
my $ra_url = $self->url;
396399
my $reload_ra = sub {

0 commit comments

Comments
 (0)