Skip to content

Commit cdb6760

Browse files
Martin LanghoffJunio C Hamano
authored andcommitted
cvsserver: better error messages
We now have different error messages when the repo is not found vs repo is not configured to allow gitcvs. Should help users during initial checkouts. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 6be32d4 commit cdb6760

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

git-cvsserver.perl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,21 @@ sub req_Root
139139
$state->{CVSROOT} = $data;
140140

141141
$ENV{GIT_DIR} = $state->{CVSROOT} . "/";
142+
unless (-d $ENV{GIT_DIR} && -e $ENV{GIT_DIR}.'HEAD') {
143+
print "E $ENV{GIT_DIR} does not seem to be a valid GIT repository\n";
144+
print "E \n";
145+
print "error 1 $ENV{GIT_DIR} is not a valid repository\n";
146+
return 0;
147+
}
142148

143-
foreach my $line ( `git-var -l` )
149+
my @gitvars = `git-var -l`;
150+
if ($?) {
151+
print "E problems executing git-var on the server -- this is not a git repository or the PATH is not set correcly.\n";
152+
print "E \n";
153+
print "error 1 - problem executing git-var\n";
154+
return 0;
155+
}
156+
foreach my $line ( @gitvars )
144157
{
145158
next unless ( $line =~ /^(.*?)\.(.*?)=(.*)$/ );
146159
$cfg->{$1}{$2} = $3;

0 commit comments

Comments
 (0)