Re: [PATCH] gitweb: Support comparing blobs (files) with different names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Koegler wrote:
> On Mon, Mar 26, 2007 at 06:12:09PM +0100, Jakub Narebski wrote:

>> It is done by adding $file_parent ('fp') to the path limiter, meaning
>> that diff command becomes:
>> 
>> 	git diff-tree [options] hpb hb -- fp f
>> 
>> instead of finding hash of a blob using git_get_hash_by_path subroutine
>> or using extended SHA-1 syntax:
>> 
>> 	git diff [options] hpb:fp hp:f
>> 
> 
> As far as I tested, this only works for renames, not
> for comparing different objects, eg:
> 
> git-diff -r -p 08727ea8bba8c81678e5cf15124ada23ad097bc3:grep.h bb95e19c5f1e470d2efe1c0e4e04c291019e4b25:refs.h
> shows differences
> 
> git-diff-tree -r 08727ea8bba8c81678e5cf15124ada23ad097bc3 bb95e19c5f1e470d2efe1c0e4e04c291019e4b25 -- grep.h refs.h
> shows no difference
> 
> As I want gitweb to be able to even do such compares (not just renames),
> I'll still need a solution for this.

Well, I haven't thought about it. Still, it is two lines changed only,
and it fixes a bug in "blobdiff" view for rename diffs.
 
Perhaps mine patch should go to 'maint', and yours to 'master' or 'next'
branch.

> My idea is, that if I got hb:f and hpb:fp, the user exactly specified
> the blobs to be compared. Then I don't want any guessing logic.

I'd rather you reuse the "no hash_parent" code, which also hand-crafts
diffinfo. Perhaps removing "git-diff-tree hpb hb -- f" code entirely.
Besides, code dealing with "blobdiff" coming from "commit", "commitdiff"
and "history" views are tested to work as expected, not so with
arbitrary diffs.

By the way, if you call git_get_hash_by_path (which is expensive, as it
calls git command), you can use resulting hash in place of
hash_base:filename as an argument to git-diff.

-- 
Jakub Narebski
Poland
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]