]> Lady’s Gitweb - Gitweb/commit
gitweb: Fix 'history' view for deleted files with history
authorJakub Narebski <redacted>
Sun, 13 Apr 2008 12:12:15 +0000 (14:12 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:12 +0000 (00:07 -0400)
commita19be71ee7c26a2050b3af99a36452494e6ec0b67aa41914acf2710dd26475a7
tree15fa10041857ba240f8af05a158405b8b4232e17aaf9ea903ad96005f27c4235
parenteeeee441feb2da00c192838ccb65db7a361561e9214e359098f1aab29ca9945c
gitweb: Fix 'history' view for deleted files with history

When asked for history of a file which is not present in given branch
("HEAD", i.e. current branch, or given by transient $hash_hase ('hb')
parameter), but is present deeper in the history (meaning that "git
rev-list --full-history $hash_base -- $file_name" is not empty), and
there is no $hash ('h') parameter set for a file, gitweb would spew
multiple of "Use of uninitialized value" warnings, and some links
would be missing.  This commit fixes this bug.

This bug occurs in the rare cases when "git log -- <path>" is empty
and "git log --full-history -- <path>" is not, or to be more exact in
the cases when full-history starts later than given branch.  It can
happen if you are using handcrafted gitwb URL, or if you follow
generic 'history' link or bookmark for a file which got deleted.

Gitweb tried to get file type ('tree', or 'blob', or even 'commit')
from the commit we start searching from (where the file was not
present), and not among found commits.  This was the cause of "Use of
uninitialized value" warnings.

This commit also add tests for such situation to t9500 test.

While we are it, return HTTP error if there is _no_ history; it means
that file or directory was not found (for given branch).  Also error
out if type of item could not be found: it should not happen now, but
better be sure.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.223313 seconds and 4 git commands to generate.