git-svn: reduce stat() calls for a backwards compatibility check

Also, this fixes a bug where in an odd case a remote named
"config" could get renamed to ".metadata".

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Wong 2007-06-13 02:37:05 -07:00 committed by Junio C Hamano
parent b3bf96d483
commit 38570a47fc

View File

@ -1457,7 +1457,7 @@ sub tmp_config {
my (@args) = @_; my (@args) = @_;
my $old_def_config = "$ENV{GIT_DIR}/svn/config"; my $old_def_config = "$ENV{GIT_DIR}/svn/config";
my $config = "$ENV{GIT_DIR}/svn/.metadata"; my $config = "$ENV{GIT_DIR}/svn/.metadata";
if (-e $old_def_config && ! -e $config) { if (! -f $config && -f $old_def_config) {
rename $old_def_config, $config or rename $old_def_config, $config or
die "Failed rename $old_def_config => $config: $!\n"; die "Failed rename $old_def_config => $config: $!\n";
} }