git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yasushi SHOJI <yashi@atmark-techno.com>
To: git@vger.kernel.org
Subject: gitweb - option to disable rename detection
Date: Tue, 16 Aug 2005 03:31:18 +0900	[thread overview]
Message-ID: <87d5ofoxvt.wl@mail2.atmark-techno.com> (raw)

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();

             reply	other threads:[~2005-08-15 18:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 18:31 Yasushi SHOJI [this message]
2005-08-15 18:53 ` gitweb - option to disable rename detection Linus Torvalds
2005-08-15 20:48   ` Yasushi SHOJI
2005-08-15 22:43     ` Linus Torvalds
2005-08-16  1:21       ` Junio C Hamano
2005-08-16 23:14       ` Yasushi SHOJI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d5ofoxvt.wl@mail2.atmark-techno.com \
    --to=yashi@atmark-techno.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).