gitweb: do not run "git diff" that is Porcelain
Jakub says that legacy-style URI to view two blob differences are never generated since 1.4.3. This codepath runs "git diff" Porcelain from the gitweb, which is a no-no. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 16, 2008 at 19:42 UTC
b54dc9fdb993a54bba11df3f247e836158b8c1f0
1 file changed
+3
-37
gitweb/gitweb.perl
+3
-37
@@ -5285,43 +5285,9 @@ sub git_blobdiff {
5285
or die_error(500, "Open git-diff-tree failed");
5286
}
5287
5288
- # old/legacy style URI
5289
- if (!%diffinfo && # if new style URI failed
5290
- defined $hash && defined $hash_parent) {
5291
- # fake git-diff-tree raw output
5292
- $diffinfo{'from_mode'} = $diffinfo{'to_mode'} = "blob";
5293
- $diffinfo{'from_id'} = $hash_parent;
5294
- $diffinfo{'to_id'} = $hash;
5295
- if (defined $file_name) {
5296
- if (defined $file_parent) {
5297
- $diffinfo{'status'} = '2';
5298
- $diffinfo{'from_file'} = $file_parent;
5299
- $diffinfo{'to_file'} = $file_name;
5300
- } else { # assume not renamed
5301
- $diffinfo{'status'} = '1';
5302
- $diffinfo{'from_file'} = $file_name;
5303
- $diffinfo{'to_file'} = $file_name;
5304
- }
5305
- } else { # no filename given
5306
- $diffinfo{'status'} = '2';
5307
- $diffinfo{'from_file'} = $hash_parent;
5308
- $diffinfo{'to_file'} = $hash;
5309
- }
5310
-
5311
- # non-textual hash id's can be cached
5312
- if ($hash =~ m/^[0-9a-fA-F]{40}$/ &&
5313
- $hash_parent =~ m/^[0-9a-fA-F]{40}$/) {
5314
- $expires = '+1d';
5315
- }
5316
-
5317
- # open patch output
5318
- open $fd, "-|", git_cmd(), "diff", @diff_opts,
5319
- '-p', ($format eq 'html' ? "--full-index" : ()),
5320
- $hash_parent, $hash, "--"
5321
- or die_error(500, "Open git-diff failed");
5322
- } else {
5323
- die_error(400, "Missing one of the blob diff parameters")
5324
- unless %diffinfo;
5288
+ # old/legacy style URI -- not generated anymore since 1.4.3.
5289
+ if (!%diffinfo) {
5290
+ die_error('404 Not Found', "Missing one of the blob diff parameters")
5291
}
5292
5293
# header