Lines 4863-4905
sub git_blobdiff {
Link Here
|
4863 |
or die_error(500, "Open git-diff-tree failed"); |
4863 |
or die_error(500, "Open git-diff-tree failed"); |
4864 |
} |
4864 |
} |
4865 |
|
4865 |
|
4866 |
# old/legacy style URI |
4866 |
# old/legacy style URI -- not generated anymore since 1.4.3. |
4867 |
if (!%diffinfo && # if new style URI failed |
4867 |
if (!%diffinfo) { |
4868 |
defined $hash && defined $hash_parent) { |
4868 |
die_error('404 Not Found', "Missing one of the blob diff parameters") |
4869 |
# fake git-diff-tree raw output |
|
|
4870 |
$diffinfo{'from_mode'} = $diffinfo{'to_mode'} = "blob"; |
4871 |
$diffinfo{'from_id'} = $hash_parent; |
4872 |
$diffinfo{'to_id'} = $hash; |
4873 |
if (defined $file_name) { |
4874 |
if (defined $file_parent) { |
4875 |
$diffinfo{'status'} = '2'; |
4876 |
$diffinfo{'from_file'} = $file_parent; |
4877 |
$diffinfo{'to_file'} = $file_name; |
4878 |
} else { # assume not renamed |
4879 |
$diffinfo{'status'} = '1'; |
4880 |
$diffinfo{'from_file'} = $file_name; |
4881 |
$diffinfo{'to_file'} = $file_name; |
4882 |
} |
4883 |
} else { # no filename given |
4884 |
$diffinfo{'status'} = '2'; |
4885 |
$diffinfo{'from_file'} = $hash_parent; |
4886 |
$diffinfo{'to_file'} = $hash; |
4887 |
} |
4888 |
|
4889 |
# non-textual hash id's can be cached |
4890 |
if ($hash =~ m/^[0-9a-fA-F]{40}$/ && |
4891 |
$hash_parent =~ m/^[0-9a-fA-F]{40}$/) { |
4892 |
$expires = '+1d'; |
4893 |
} |
4894 |
|
4895 |
# open patch output |
4896 |
open $fd, "-|", git_cmd(), "diff", @diff_opts, |
4897 |
'-p', ($format eq 'html' ? "--full-index" : ()), |
4898 |
$hash_parent, $hash, "--" |
4899 |
or die_error(500, "Open git-diff failed"); |
4900 |
} else { |
4901 |
die_error(400, "Missing one of the blob diff parameters") |
4902 |
unless %diffinfo; |
4903 |
} |
4869 |
} |
4904 |
|
4870 |
|
4905 |
# header |
4871 |
# header |