From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Narebski Subject: [PATCH] gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches Date: Sat, 31 Mar 2007 16:52:33 +0200 Message-ID: <200703311652.33481.jnareb@gmail.com> References: <11748548622888-git-send-email-mkoegler@auto.tuwien.ac.at> <200703280158.54929.jnareb@gmail.com> <20070328210301.GA57@auto.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org To: Martin Koegler X-From: git-owner@vger.kernel.org Sat Mar 31 23:50:26 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 1HXlSr-0000ch-IT for gcvg-git@gmane.org; Sat, 31 Mar 2007 23:50:25 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbXCaVuS (ORCPT ); Sat, 31 Mar 2007 17:50:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752573AbXCaVuS (ORCPT ); Sat, 31 Mar 2007 17:50:18 -0400 Received: from ug-out-1314.google.com ([66.249.92.175]:28764 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbXCaVuQ (ORCPT ); Sat, 31 Mar 2007 17:50:16 -0400 Received: by ug-out-1314.google.com with SMTP id 44so1166069uga for ; Sat, 31 Mar 2007 14:50:15 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-disposition:message-id:content-type:content-transfer-encoding; b=bTQ6qJIL1vRY34R5zy8kAAd4SKXbgOqij2QCt6uC8jpK9PZUorrFgIC/8vsD2SVkVstm35QYsJAy77D7En494HMqanJjWIavsrRdCjM9pTT15GYCkIu8zvHV+gpXTG5cbanGccr+8szcvmcE062CaJ3/Nyxo0g+q8v5aPn5N6aw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-disposition:message-id:content-type:content-transfer-encoding; b=uGULHblCsPvreAhVzGFPquL796wpQ4VJjm/oDsdYnefsQ7n3H24D34d+W32htx7RoiMIA1wR50eaNslShJpJqwjvK+3KmTOcXhVD/npKpn5PLqv1NjrrjASAomWVYnjc3QXmZPJ7qtOzJrsxAmp+YPp0wK9+IoB78A+RjsLUKOY= Received: by 10.82.178.11 with SMTP id a11mr6144696buf.1175377815233; Sat, 31 Mar 2007 14:50:15 -0700 (PDT) Received: from host-89-229-25-173.torun.mm.pl ( [89.229.25.173]) by mx.google.com with ESMTP id w7sm13595673mue.2007.03.31.14.50.12; Sat, 31 Mar 2007 14:50:13 -0700 (PDT) User-Agent: KMail/1.9.3 In-Reply-To: <20070328210301.GA57@auto.tuwien.ac.at> Content-Disposition: inline Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: git_patchset_body needs patch generated with --full-index option to detect split patches, meaning two patches which corresponds to single difftree (raw diff) entry. An example of such situation is changing type (mode) of a file, e.g. from plain file to symbolic link. Add, in git_blobdiff, --full-index option to patch generating git diff invocation, for the 'html' format output ("blobdiff" view). "blobdiff_plain" still uses shortened sha1 in the extended git diff header "index ..[ ]" line. git_patchset_body and git_commitdiff (but not git_blobdiff) were adjusted for the split patches in commit 6d55f05576851aedc7c53f7438c1d505c22ee78f Noticed-by: Martin Koegler Signed-off-by: Jakub Narebski --- On Wed, Mar 28, 2007 at 23:03 +0200, Martin Koegler wrote: > Blobdiff (html output) in its current version can not handle symlinks: > > > diff --git a/x b/x > > deleted file mode 100644 (file) > > index 190a180..873fb8d > > --- a/x > > +++ /dev/null > > @@ -1 +0,0 @@ > > -123 > > diff --git a/ b/ > > new file mode 120000 (symlink) > > index 190a180..873fb8d > > --- /dev/null > > +++ b/ > > @@ -0,0 +1 @@ > > +file3 > > \ No newline at end of file > > This was generated by "diff to current" in the history view of a file, > which was changed between symlink and normal file. This patch fixes it. gitweb/gitweb.perl | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4f34c29..d1f4aeb 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3936,7 +3936,8 @@ sub git_blobdiff { # open patch output open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, - '-p', $hash_parent_base, $hash_base, + '-p', ($format eq 'html' ? "--full-index" : ()), + $hash_parent_base, $hash_base, "--", (defined $file_parent ? $file_parent : ()), $file_name or die_error(undef, "Open git-diff-tree failed"); } @@ -3971,7 +3972,8 @@ sub git_blobdiff { } # open patch output - open $fd, "-|", git_cmd(), "diff", '-p', @diff_opts, + open $fd, "-|", git_cmd(), "diff", @diff_opts, + '-p', ($format eq 'html' ? "--full-index" : ()), $hash_parent, $hash, "--" or die_error(undef, "Open git-diff failed"); } else { -- 1.5.0.5