mirror of
https://github.com/git/git.git
synced 2024-05-13 13:26:08 +02:00
cvsserver: cleanup extra slashes in filename arguments
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
2c3af7e748
commit
1899cbc5b2
|
@ -2309,6 +2309,9 @@ sub filenamesplit
|
||||||
return ( $filepart, $dirpart );
|
return ( $filepart, $dirpart );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cleanup various junk in filename (try to canonicalize it), and
|
||||||
|
# add prependdir to accomodate running CVS client from a
|
||||||
|
# subdirectory (so the output is relative to top directory of the project).
|
||||||
sub filecleanup
|
sub filecleanup
|
||||||
{
|
{
|
||||||
my $filename = shift;
|
my $filename = shift;
|
||||||
|
@ -2320,11 +2323,36 @@ sub filecleanup
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($filename eq ".")
|
||||||
|
{
|
||||||
|
$filename="";
|
||||||
|
}
|
||||||
$filename =~ s/^\.\///g;
|
$filename =~ s/^\.\///g;
|
||||||
|
$filename =~ s%/+%/%g;
|
||||||
$filename = $state->{prependdir} . $filename;
|
$filename = $state->{prependdir} . $filename;
|
||||||
|
$filename =~ s%/$%%;
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove prependdir from the path, so that is is relative to the directory
|
||||||
|
# the CVS client was started from, rather than the top of the project.
|
||||||
|
# Essentially the inverse of filecleanup().
|
||||||
|
sub remove_prependdir
|
||||||
|
{
|
||||||
|
my($path) = @_;
|
||||||
|
if(defined($state->{prependdir}) && $state->{prependdir} ne "")
|
||||||
|
{
|
||||||
|
my($pre)=$state->{prependdir};
|
||||||
|
$pre=~s%/$%%;
|
||||||
|
if(!($path=~s%^\Q$pre\E/?%%))
|
||||||
|
{
|
||||||
|
$log->fatal("internal error missing prependdir");
|
||||||
|
die("internal error missing prependdir");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
sub validateGitDir
|
sub validateGitDir
|
||||||
{
|
{
|
||||||
if( !defined($state->{CVSROOT}) )
|
if( !defined($state->{CVSROOT}) )
|
||||||
|
|
Loading…
Reference in New Issue