@matheusbsbs / matheus-bagliano / commits / cdb6760e6f
Fork 0

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>

Martin Langhoff committed Mar 4, 2006 at 17:47 UTC cdb6760e6f4ba956604d715df191b6f442238d5d
1 file changed +14 -1
git-cvsserver.perl
+14 -1
@@ -139,8 +139,21 @@ sub req_Root
139 $state->{CVSROOT} = $data;
140
141 $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 + }
148
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 )
157 {
158 next unless ( $line =~ /^(.*?)\.(.*?)=(.*)$/ );
159 $cfg->{$1}{$2} = $3;