summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0aea337)
raw | patch | inline | side by side (parent: 0aea337)
author | Jakub Narebski <jnareb@gmail.com> | |
Sun, 27 Aug 2006 21:49:36 +0000 (23:49 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 27 Aug 2006 22:35:01 +0000 (15:35 -0700) |
Added new global configuration variable @diff_opts, which holds
additional options (parameters) to git-diff and git-diff-tree, usually
dealing rename/copying detection. Default value is '-M', taken from
git_commit subroutine. Description of options and their approximate
cost by Junio C Hamano.
Changes:
* git_commitdiff, git_blobdiff and git_blobdiff_plain now use '-M'
instead of '-M', '-C'
* git-diff now uses the same options as git-diff-tree
* git_comittdiff_plain now uses '-M' instead of '-B'
and is now rename-aware
* git_rss uses now '-M' instead of ()
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
additional options (parameters) to git-diff and git-diff-tree, usually
dealing rename/copying detection. Default value is '-M', taken from
git_commit subroutine. Description of options and their approximate
cost by Junio C Hamano.
Changes:
* git_commitdiff, git_blobdiff and git_blobdiff_plain now use '-M'
instead of '-M', '-C'
* git-diff now uses the same options as git-diff-tree
* git_comittdiff_plain now uses '-M' instead of '-B'
and is now rename-aware
* git_rss uses now '-M' instead of ()
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d28207b1f5eb5a0e5f43f0324797f2a9550892a..1430a7a8aa5cb9b881f54df83c06a36412451d5c 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
return ($ctype, $suffix, $command);
}
+# rename detection options for git-diff and git-diff-tree
+# - default is '-M', with the cost proportional to
+# (number of removed files) * (number of new files).
+# - more costly is '-C' (or '-C', '-M'), with the cost proportional to
+# (number of changed files + number of removed files) * (number of new files)
+# - even more costly is '-C', '--find-copies-harder' with cost
+# (number of files in the original tree) * (number of new files)
+# - one might want to include '-B' option, e.g. '-B', '-M'
+our @diff_opts = ('-M'); # taken from git_commit
+
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
require $GITWEB_CONFIG if -e $GITWEB_CONFIG;
if (!defined $parent) {
$parent = "--root";
}
- open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $parent, $hash
+ open my $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts, $parent, $hash
or die_error(undef, "Open git-diff-tree failed");
my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed");
if (defined $hash_base && defined $hash_parent_base) {
if (defined $file_name) {
# read raw output
- open $fd, "-|", $GIT, "diff-tree", '-r', '-M', '-C', $hash_parent_base, $hash_base,
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts, $hash_parent_base, $hash_base,
"--", $file_name
or die_error(undef, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
# try to find filename from $hash
# read filtered raw output
- open $fd, "-|", $GIT, "diff-tree", '-r', '-M', '-C', $hash_parent_base, $hash_base
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts, $hash_parent_base, $hash_base
or die_error(undef, "Open git-diff-tree failed");
@difftree =
# ':100644 100644 03b21826... 3b93d5e7... M ls-files.c'
}
# open patch output
- open $fd, "-|", $GIT, "diff-tree", '-r', '-p', '-M', '-C', $hash_parent_base, $hash_base,
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts,
+ '-p', $hash_parent_base, $hash_base,
"--", $file_name
or die_error(undef, "Open git-diff-tree failed");
}
}
# open patch output
- open $fd, "-|", $GIT, "diff", '-p', $hash_parent, $hash
+ open $fd, "-|", $GIT, "diff", '-p', @diff_opts, $hash_parent, $hash
or die_error(undef, "Open git-diff failed");
} else {
die_error('404 Not Found', "Missing one of the blob diff parameters")
my $fd;
my @difftree;
if ($format eq 'html') {
- open $fd, "-|", $GIT, "diff-tree", '-r', '-M', '-C',
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts,
"--patch-with-raw", "--full-index", $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");
}
} elsif ($format eq 'plain') {
- open $fd, "-|", $GIT, "diff-tree", '-r', '-p', '-B', $hash_parent, $hash
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts,
+ '-p', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed");
} else {
last;
}
my %cd = parse_date($co{'committer_epoch'});
- open $fd, "-|", $GIT, "diff-tree", '-r', $co{'parent'}, $co{'id'} or next;
+ open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts,
+ $co{'parent'}, $co{'id'}
+ or next;
my @difftree = map { chomp; $_ } <$fd>;
- close $fd or next;
+ close $fd
+ or next;
print "<item>\n" .
"<title>" .
sprintf("%d %s %02d:%02d", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . " - " . esc_html($co{'title'}) .