From mboxrd@z Thu Jan 1 00:00:00 1970 From: mkoegler@auto.tuwien.ac.at (Martin Koegler) Subject: Supporting more gitweb diff possibities Date: Sun, 25 Mar 2007 22:26:42 +0200 Message-ID: <20070325202642.GA20201@auto.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: git@vger.kernel.org To: Jakub Narebski X-From: git-owner@vger.kernel.org Sun Mar 25 22:26:52 2007 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1HVZIg-0007n2-KZ for gcvg-git@gmane.org; Sun, 25 Mar 2007 22:26:51 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752280AbXCYU0r convert rfc822-to-quoted-printable (ORCPT ); Sun, 25 Mar 2007 16:26:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752311AbXCYU0r (ORCPT ); Sun, 25 Mar 2007 16:26:47 -0400 Received: from thor.auto.tuwien.ac.at ([128.130.60.15]:41398 "EHLO thor.auto.tuwien.ac.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbXCYU0q (ORCPT ); Sun, 25 Mar 2007 16:26:46 -0400 Received: from localhost (localhost [127.0.0.1]) by thor.auto.tuwien.ac.at (Postfix) with ESMTP id 65FAE73515C1; Sun, 25 Mar 2007 22:26:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at auto.tuwien.ac.at Received: from thor.auto.tuwien.ac.at ([127.0.0.1]) by localhost (thor.auto.tuwien.ac.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ocdZVFYs8Rcv; Sun, 25 Mar 2007 22:26:42 +0200 (CEST) Received: by thor.auto.tuwien.ac.at (Postfix, from userid 3001) id B8F91735ADF8; Sun, 25 Mar 2007 22:26:42 +0200 (CEST) Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-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 =3D> href([Parameter])}, [Title])=20 mfg Martin K=F6gler 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; } =20 + print ''; print "\n" . ""; } gitweb.js: ---------- function getCookie(name) { var name=3Dname+"=3D"; var c=3Ddocument.cookie; var p=3Dc.indexOf(name); if(p=3D=3D-1) return null; c=3Dc.substr(p+name.length,c.length); p=3Dc.indexOf(";"); if(p=3D=3D-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=3Ddocument.createElement("a"); l.appendChild(document.createTextNode(linktext)); l.href=3Dhref; return l; } function createLinkGroup(href1, basetxt, href2, difftxt) { var l=3Ddocument.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=3Dnull; this.h=3Dnull; this.hb=3Dnull; this.f=3Dnull; this.ToRef=3DToRef; } function ToRef() { var parts=3Dnew Array(); if(this.f) parts.push("f=3D"+this.f); if(this.h) parts.push("h=3D"+this.h); if(this.hb) parts.push("hb=3D"+this.hb); if(this.t) parts.push("t=3D"+this.t); return parts.join("@"); } function splitGitRef(ref) { var parts=3Dref.split("@"); var res=3Dnew GitRef(); var i; for(i=3D0;i1) { var parts=3DUrls[1].split(";"); var i; for(i=3D0;i