]> asedeno.scripts.mit.edu Git - git.git/commit
gitweb: Use git-diff-tree or git-diff patch output for blobdiff
authorJakub Narebski <jnareb@gmail.com>
Fri, 25 Aug 2006 19:13:34 +0000 (21:13 +0200)
committerJunio C Hamano <junkio@cox.net>
Sat, 26 Aug 2006 02:42:07 +0000 (19:42 -0700)
commit7c5e2ebb5d8ca3d8428e19593c69a4f329d64855
treea269829fb9f6e72e19077fe18f37c235966c87a6
parent990dd0de51530a47f4c8fad961268d4b8545a7be
gitweb: Use git-diff-tree or git-diff patch output for blobdiff

This is second part of removing gitweb dependency on external
diff (used in git_diff_print).

Get rid of git_diff_print invocation in git_blobdiff, and use either
git-diff-tree (when both hash_base and hash_parent_base are provided)
patch format or git-diff patch format (when only hash and hash_parent
are provided) for output.

Supported URI schemes, and output formats:
* New URI scheme: both hash_base and hash_parent_base (trees-ish
  containing blobs versions we want to compare) are provided.
  Also either filename is provided, or hash (of blob) is provided
  (we try to find filename then).

  For this scheme we have copying and renames detection, mode changes,
  file types etc., and information extended diff header is correct.

* Old URI scheme: hash_parent_base is not provided, we use hash and
  hash_parent to directly compare blobs using git-diff. If no filename
  is given, blobs hashes are used in place of filenames.

  This scheme has always "blob" as file type, it cannot detect mode
  changes, and we rely on CGI parameters to provide name of the file.

Added git_to_hash subroutine, which transforms symbolic name or list
of symbolic name to hash or list of hashes using git-rev-parse.

To have "blob" instead of "unknown" (or "file" regardless of the type)
in "gitweb diff header" for legacy scheme, file_type function now
returns its argument if it is not octal string.

Added support for fake "2" status code in git_patchset_body. Such code
is generated by git_blobdiff in legacy scheme case.

ATTENTION: The order of arguments (operands) to git-diff is reversed
(sic!) to have correct diff in the legacy (no hash_parent_base) case.
$hash_parent, $hash ordering is commented out, as it gives reversed
patch (at least for git version 1.4.1.1) as compared to output in new
scheme and output of older gitweb version.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl