Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH 2/7] gitweb: Support comparing blobs with different names

From: Martin Koegler <hidden>
Date: 2016-06-15 22:43:07

Possibly related (same subject, not in this thread)

On Sun, Apr 29, 2007 at 11:35:49PM +0200, Jakub Narebski wrote:
On Monday, 16 April 2007, Martin Koegler wrote:
quoted
Currently, blobdiff can only compare blobs with different file
names, if no hb/hpb parameters are present.
I've already posted a new version of this patch:
http://www.spinics.net/lists/git/msg28812.html

Can you please look at it.
quoted
Signed-off-by: Martin Koegler <redacted>
---
New version, as I found a bug in the expiration handling code.

I unified all blobdiff variants and added support for comparing blobs
with different names.

If h/hp parameter are missing, I need to generate them with
git_get_hash_by_path, as the are needed for the html header, which is
generated before parsing the git-diff output.
git_get_hash_by_path uses git-ls-tree but it does not catch all the info;
perhaps git_get_info_by_path would be called for here.
I now only need the hash of the blob, if not passed as parameter, to
generate a correct header.
[...]  
quoted
+	if (defined $hash_parent_base && defined $file_parent && !defined $hash_parent) {
+	    $hash_parent = git_get_hash_by_path($hash_parent_base, $file_parent);
+	}
[...]
quoted
+	# open patch output
+	open $fd, "-|", git_cmd(), "diff", @diff_opts,
+	$hash_parent, $hash, "--"
+		or die_error(undef, "Open git-diff failed");
You would most probably use now "$hash_base:$file_name" instead of $hash
if $hash_base is defined, i.e.

  defined $hash_base ? "$hash_base:$file_name" : $hash

and similarly for $hash_parent parameter now that <tree>:<path> form
respects mode changes information.
Addressed in new patch.

mfg Martin Kögler
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help