From: Martin Koegler Date: Sun, 25 Mar 2007 20:26:42 GMT Subject: Supporting more gitweb diff possibities Message-ID: <20070325202642.GA20201@auto.tuwien.ac.at> I have done a first series of 6 patches, which improves blobdiff and adds treediff. [PATCH] gitweb: show no difference message This patch shows an "no difference" message instead of nothing for equal objects. [PATCH] gitweb: Support comparing blobs with different names This patch adds support for comparing objects with different file names using hb/hbp. [PATCH] gitweb: link base commit (hpb) to blobdiff output Add link the parent commit, as there is currently no such link. [PATCH] gitweb: support filename prefix in git_patchset_body [PATCH] gitweb: support filename prefix in git_difftree_body [PATCH] gitweb: Add treediff These 3 patches add the treediff method. Its a complete reworked verion. As git-diff-tree outputs relativ patches (discards part of the compared tree objects), the first two patches are necessary to produce correct links in the treediff output. I do not see many possibilties for code sharing with git_commitdiff: The only large portion of common code is calling git-diff-tree. I don't think that this would justify the more complex code. To test these patches, I still use a JavaScript implementation (see below). I'm working on the server side implementation. The next patch, I'm currently working on, will introduce a wrapper for all calls to $cgi->a({-href => href([Parameter])}, [Title]) mfg Martin Kögler diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 71d0933..db58319 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1837,6 +1837,7 @@ sub git_footer_html { close $fd; } + print ''; print "\n" . ""; } gitweb.js: ---------- function getCookie(name) { var name=name+"="; var c=document.cookie; var p=c.indexOf(name); if(p==-1) return null; c=c.substr(p+name.length,c.length); p=c.indexOf(";"); if(p==-1) return c; else return c.substr(0, p); } function insertAfter(elem, node) { if(node.nextSibling) node.parentNode.insertBefore(elem, node.nextSibling); else node.parentNode.appendChild(elem); } function createLink(href, linktext) { var l=document.createElement("a"); l.appendChild(document.createTextNode(linktext)); l.href=href; return l; } function createLinkGroup(href1, basetxt, href2, difftxt) { var l=document.createElement("span"); l.appendChild(document.createTextNode(" (")); l.appendChild(createLink(href1, basetxt)); l.appendChild(document.createTextNode(" | ")); l.appendChild(createLink(href2, difftxt)); l.appendChild(document.createTextNode(") ")); return l; } function GitRef() { this.t=null; this.h=null; this.hb=null; this.f=null; this.ToRef=ToRef; } function ToRef() { var parts=new Array(); if(this.f) parts.push("f="+this.f); if(this.h) parts.push("h="+this.h); if(this.hb) parts.push("hb="+this.hb); if(this.t) parts.push("t="+this.t); return parts.join("@"); } function splitGitRef(ref) { var parts=ref.split("@"); var res=new GitRef(); var i; for(i=0;i1) { var parts=Urls[1].split(";"); var i; for(i=0;i