From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: Re: git diff woes Date: Tue, 13 Nov 2007 00:59:41 +0000 (GMT) Message-ID: References: <4738208D.1080003@op5.se> <47382C84.50408@op5.se> <7vhcjr2lte.fsf@gitster.siamese.dyndns.org> <4738E9E6.2040001@op5.se> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Junio C Hamano , Git Mailing List To: Andreas Ericsson X-From: git-owner@vger.kernel.org Tue Nov 13 02:00:19 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1Irk8X-0003Sh-1m for gcvg-git-2@gmane.org; Tue, 13 Nov 2007 02:00:17 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755398AbXKMBAA (ORCPT ); Mon, 12 Nov 2007 20:00:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755470AbXKMA77 (ORCPT ); Mon, 12 Nov 2007 19:59:59 -0500 Received: from mail.gmx.net ([213.165.64.20]:48014 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755094AbXKMA77 (ORCPT ); Mon, 12 Nov 2007 19:59:59 -0500 Received: (qmail invoked by alias); 13 Nov 2007 00:59:56 -0000 Received: from unknown (EHLO openvpn-client) [138.251.11.103] by mail.gmx.net (mp040) with SMTP; 13 Nov 2007 01:59:56 +0100 X-Authenticated: #1490710 X-Provags-ID: V01U2FsdGVkX1+TuPFcW6OTeFOkxRHdtkmsHqD4F4ou8z8EtfuidH Y6lF2G3tiMD1CO X-X-Sender: gene099@racer.site In-Reply-To: <4738E9E6.2040001@op5.se> X-Y-GMX-Trusted: 0 Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Hi, On Tue, 13 Nov 2007, Andreas Ericsson wrote: > Junio C Hamano wrote: > > Andreas Ericsson writes: > > > > > In the check_ntpd.c program, there is no bug. I found the git diff > > > output surprising, so I reported it. > > > > This is what I get from "GNU diff -pu" which makes me surpried > > that anybody finds "git diff" hunk header surprising. Notice > > that hunk at line 84. > > > > --- read-cache.c 2007-11-12 12:08:00.000000000 -0800 > > +++ read-cache.c+ 2007-11-12 12:07:54.000000000 -0800 > > @@ -60,7 +60,7 @@ static int ce_compare_data(struct cache_ > > return match; > > } > > -static int ce_compare_link(struct cache_entry *ce, size_t expected_size) > > +static int ce_compare_lonk(struct cache_entry *ce, size_t expected_size) > > { > > int match = -1; > > char *target; > > @@ -84,7 +84,7 @@ static int ce_compare_link(struct cache_ > > match = memcmp(buffer, target, size); > > free(buffer); > > free(target); > > - return match; > > + return match + 0; > > } > > static int ce_compare_gitlink(struct cache_entry *ce) > > > I notice it, and I don't like it. I guess I'm just used to git being > smarter than their GNU tool equivalents, especially since it only ever > applies patches in full. I still think the existing behaviour is reasonable. When I read a diff (and remember, the hunk headers are _only_ there for the reviewer's pleasure), the function names are a hint for _me_ where to look, and which is the context, in my existing, _original_ file. That is, unless I have already applied the patch, and am looking for the reverse patch. And, lo and behold, the reverse patch generated by git-diff really shows the now-current function name! So IMO "fixing" this behaviour would be a regression. Ciao, Dscho