From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: gitweb - option to disable rename detection Date: Tue, 16 Aug 2005 03:31:18 +0900 Message-ID: <87d5ofoxvt.wl@mail2.atmark-techno.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-From: git-owner@vger.kernel.org Mon Aug 15 20:33:41 2005 Return-path: Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E4jkX-0005Nn-EL for gcvg-git@gmane.org; Mon, 15 Aug 2005 20:31:53 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964895AbVHOSbb (ORCPT ); Mon, 15 Aug 2005 14:31:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964899AbVHOSbb (ORCPT ); Mon, 15 Aug 2005 14:31:31 -0400 Received: from shop.atmark-techno.com ([210.191.215.173]:50868 "EHLO mail2.atmark-techno.com") by vger.kernel.org with ESMTP id S964895AbVHOSb3 (ORCPT ); Mon, 15 Aug 2005 14:31:29 -0400 Received: from smtp.local-network (dns1.atmark-techno.com [210.191.215.170]) by mail2.atmark-techno.com (Postfix) with ESMTP id 0BF1C76A; Tue, 16 Aug 2005 03:31:24 +0900 (JST) Received: from wat.atmark-techno.com (unknown [192.168.10.81]) by smtp.local-network (Postfix) with ESMTP id 3BF85B61F; Tue, 16 Aug 2005 03:34:04 +0900 (JST) To: git@vger.kernel.org User-Agent: Wanderlust/2.14.0 Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Hi all, It seems to me that git-diff-tree needs huge memory if you try to diff on big change with rename detection enabled. This isn't problem for sane project but if you create a repo with only major releases imports, git-diff-tree run by git_commit() eats system memory and die ;P so here is a proposal patch to add an option to disable rename detection on selected project. # please bear with me! I _know_ my perl code sucks. this is just to # show my idea. regards, -- yashi diff --git a/gitweb.cgi b/gitweb.cgi --- a/gitweb.cgi +++ b/gitweb.cgi @@ -40,6 +40,11 @@ my $home_text = "indextext.html"; #my $projects_list = $projectroot; my $projects_list = "index/index.aux"; +# rename detection on big change require a lot of memory. If your tree +# has big change commit, list those project names to disable rename +# detection. most sane project doesn't need to disable this feature. +my $projects_disable_rename_detection = ""; + # input validation and dispatch my $action = $cgi->param('a'); if (defined $action) { @@ -1572,6 +1577,17 @@ sub git_log { git_footer_html(); } +sub git_diff_tree_options { + my $found = 0; + my @list = split(/ /, $projects_disable_rename_detection); + foreach my $p (@list) { + if ($project eq $p) { + $found = 1; + } + } + $found ? "" : "-M"; +} + sub git_commit { my %co = git_read_commit($hash); if (!%co) { @@ -1587,7 +1603,8 @@ sub git_commit { $root = " --root"; $parent = ""; } - open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed."); + my $opts = git_diff_tree_options(); + open my $fd, "-|", "$gitbin/git-diff-tree -r $opts $root $parent $hash" or die_error(undef, "Open failed."); @difftree = map { chomp; $_ } <$fd>; close $fd or die_error(undef, "Reading diff-tree failed."); git_header_html();