]> Lady’s Gitweb - Gitweb/commit
gitweb: squelch "uninitialized value" warning
authorØyvind A. Holm <redacted>
Tue, 12 Jan 2016 03:31:56 +0000 (04:31 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
commit82fe7d0b840b89b0ae5c3351e928daef0ec9ef630542cd026040b3333adcf03f
tree94c8477e994396138e33143c6563d522a66d47591f95cb1426d187e8e1c69427
parent63a92ba604e2784e0c64043f5ce505231e3efe80431e524bdc0df554969cf040
gitweb: squelch "uninitialized value" warning

git_object() chomps $type that is read from "cat-file -t", but
it does so before checking if $type is defined, resulting in
a Perl warning in the server error log:

  gitweb.cgi: Use of uninitialized value $type in scalar chomp at
  [...]/gitweb.cgi line 7579., referer: [...]

when trying to access a non-existing commit, for example:

  http://HOST/?p=PROJECT.git;a=commit;h=NON_EXISTING_COMMIT

Check the value in $type before chomping.  This will cause us to
call href with its action parameter set to undef when formulating
the URL to redirect to, but that is harmless, as the function treats
a parameter that set to undef as if it does not exist.

Signed-off-by: Øyvind A. Holm <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.071517 seconds and 4 git commands to generate.