From: Junio C Hamano Date: Sat, 19 Apr 2008 05:58:32 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.6-rc0~142 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d9f39d9838f089c145817c6c0f25ffedcb1c500e?ds=inline;hp=-c Merge branch 'maint' * maint: gitweb: Fix 'history' view for deleted files with history Document that WebDAV doesn't need git on the server, and works over SSL git-remote: reject adding remotes with invalid names am: POSIX portability fix --- d9f39d9838f089c145817c6c0f25ffedcb1c500e diff --combined gitweb/gitweb.perl index e69d7fd07b,746153ffe8..a48bebb1bc --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@@ -369,12 -369,7 +369,12 @@@ sub filter_snapshot_fmts } our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++"; -do $GITWEB_CONFIG if -e $GITWEB_CONFIG; +if (-e $GITWEB_CONFIG) { + do $GITWEB_CONFIG; +} else { + our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++"; + do $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM; +} # version of the core git binary our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown"; @@@ -5176,14 -5171,26 +5176,26 @@@ sub git_history my $refs = git_get_references(); my $limit = sprintf("--max-count=%i", (100 * ($page+1))); + my @commitlist = parse_commits($hash_base, 101, (100 * $page), + $file_name, "--full-history"); + if (!@commitlist) { + die_error('404 Not Found', "No such file or directory on given branch"); + } + if (!defined $hash && defined $file_name) { - $hash = git_get_hash_by_path($hash_base, $file_name); + # some commits could have deleted file in question, + # and not have it in tree, but one of them has to have it + for (my $i = 0; $i <= @commitlist; $i++) { + $hash = git_get_hash_by_path($commitlist[$i]{'id'}, $file_name); + last if defined $hash; + } } if (defined $hash) { $ftype = git_get_type($hash); } - - my @commitlist = parse_commits($hash_base, 101, (100 * $page), $file_name, "--full-history"); + if (!defined $ftype) { + die_error(undef, "Unknown type of object"); + } my $paging_nav = ''; if ($page > 0) {