From: Eric Wong Date: Sat, 19 May 2007 09:58:37 +0000 (-0700) Subject: git-svn: avoid crashing svnserve when creating new directories X-Git-Tag: v1.5.1.6~3 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=6442754d6cc0056cf5b69b43d218f8b6d317e7f5;p=git.git git-svn: avoid crashing svnserve when creating new directories When sorting directory names by depth (slash ("/") count) and closing the deepest directories first (as the protocol requires), we failed to put the root baton (with an empty string as its key "") after top-level directories (which did not have any slashes). This resulted in svnserve being in a situation it couldn't handle and caused a segmentation fault on the remote server. This bug did not affect users of DAV and filesystem repositories. Signed-off-by: Eric Wong Confirmed-by: Matthieu Moy Signed-off-by: Junio C Hamano --- diff --git a/git-svn.perl b/git-svn.perl index f4c9ff1b8..b87dedc99 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2841,8 +2841,10 @@ sub close_edit { my ($self) = @_; my ($p,$bat) = ($self->{pool}, $self->{bat}); foreach (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$bat) { + next if $_ eq ''; $self->close_directory($bat->{$_}, $p); } + $self->close_directory($bat->{''}, $p); $self->SUPER::close_edit($p); $p->clear; }