]> Lady’s Gitweb - Gitweb/commit
gitweb: Fix two 'uninitialized value' warnings in git_tree()
authorJakub Narebski <redacted>
Thu, 2 Oct 2008 14:50:04 +0000 (16:50 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:34 +0000 (00:07 -0400)
commit2227b26fd5b74588a606f09e023afd8e9afc2e832561822ce557fc4409e60e2e
tree9e7dce418fc915c96870d046b7bea032089b8f91b7c3d7609fceb1e81ba25410
parente05bc45323b395d5e9f74b11709e98f1ae9e2c77ddee4b3a89ea4c44b52d4141
gitweb: Fix two 'uninitialized value' warnings in git_tree()

If we did try to access nonexistent directory or file, which means
that git_get_hash_by_path() returns `undef`, uninitialized $hash
variable was passed to 'open' call.  Now we fail early with "404 Not
Found - No such tree" error.  (If we try to access something which
does not resolve to tree-ish, for example a file / 'blob' object, the
error will be caught later, as "404 Not Found - Reading tree failed"
error).

If we tried to use 'tree' action without $file_name ('f' parameter)
set, which means either tree given by hash or a top tree (and we
currently cannot distinguish between those two cases), we cannot print
path breadcrumbs with git_print_page_path().  Fix this by moving call
to git_print_page_path() inside conditional.

Signed-off-by: Jakub Narebski <redacted>
Acked-by: Petr Baudis <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
gitweb.perl
This page took 0.21559 seconds and 4 git commands to generate.