Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sat, 19 Apr 2008 05:58:32 +0000 (22:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 19 Apr 2008 05:58:32 +0000 (22:58 -0700)
* 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

1  2 
gitweb/gitweb.perl
diff --combined gitweb/gitweb.perl
index e69d7fd07b74d2e1c06f26e98eb72c83183c19f8,746153ffe8fb020db4f6a4aafe779848b5260bb7..a48bebb1bc01ec6af718cf014db0155145508e8b
@@@ -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) {