{"thread":{"id":"19418","subject":"[RFC/PATCH] gitweb: Fail early","startedAt":"2009-05-19T20:40:31Z","lastAt":"2009-05-19T20:40:31Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"114303","messageId":"200905192240.34199.jnareb@gmail.com","threadId":"19418","inReplyTo":null,"subject":"[RFC/PATCH] gitweb: Fail early","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-05-19T20:40:31Z","receivedAt":"2009-05-19T20:40:31Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Return HTTP 500 Internal Server Error if $GIT is not defined (which\nwould cause Perl error), or if \"$GIT --version\" failed to run.  This\nshould not happen often, but I think this change would make diagnosing\nmisconfiguration easier.\n---\nIs \"git version\" in 'git --version' output ensured? How did other git\nimplementations and ports (like msysGit and jgit) output of --version\nlooks like?\n\nDoes it make sense to check whether output matches, and if it doesn't\nmatch assume that $GIT points to something other, perhaps some other\ngit like GIT Interactive Tools or something?\n\nDoes it makes sense to try various other checks to make error message\nmore detailed like $GIT is not found, or is not executable?\n\ndiff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl\nindex 05702e4..0cb53ca 100755\n--- i/gitweb/gitweb.perl\n+++ w/gitweb/gitweb.perl\n@@ -471,7 +471,13 @@ if (-e $GITWEB_CONFIG) {\n }\n \n # version of the core git binary\n+if (!defined $GIT) {\n+\tdie_error(500, \"Undefined path to git binary\");\n+}\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n+if ($?) {\n+\tdie_error(500, \"Error calling '$GIT --version': $?\");\n+}\n \n $projects_list ||= $projectroot;\n \n"}]}