Commit 2d7a353
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 <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>1 parent 6e2dfb1 commit 2d7a353
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4421 | 4421 | | |
4422 | 4422 | | |
4423 | 4423 | | |
| 4424 | + | |
4424 | 4425 | | |
4425 | 4426 | | |
4426 | 4427 | | |
| |||
4461 | 4462 | | |
4462 | 4463 | | |
4463 | 4464 | | |
| 4465 | + | |
4464 | 4466 | | |
4465 | | - | |
4466 | 4467 | | |
4467 | 4468 | | |
4468 | 4469 | | |
| |||
0 commit comments