From: Tim Chase <git@tim•thechases.com>
To: Jeff King <peff@peff•net>
Cc: Junio C Hamano <gitster@pobox•com>, git@vger•kernel.org
Subject: Re: misleading diff-hunk header
Date: Fri, 24 Aug 2012 19:41:54 -0500 [thread overview]
Message-ID: <50381F52.9030007@tim.thechases.com> (raw)
In-Reply-To: <20120824164415.GA23262@sigill.intra.peff.net>
On 08/24/12 11:44, Jeff King wrote:
> With the old code, you'd get:
>
> diff --git a/old b/new
> index f384549..1066a25 100644
> --- a/old
> +++ b/new
> @@ -2,3 +2,3 @@ one
> two
> -three
> +three -- modified
> four
>
> So the hunk header is showing you something useful; the element just
> above your context. But with my patch, you'd see:
>
> diff --git a/old b/new
> index f384549..1066a25 100644
> --- a/old
> +++ b/new
> @@ -2,3 +2,3 @@ two
> two
> -three
> +three -- modified
> four
>
> I.e., it shows the element just before the change, which is already in
> the context anyway. So it's actually less useful. Although note that the
> current behavior is not all that useful, either; it is not really giving
> you any information about the change, but rather just showing one extra
> line of context.
>
> So I would say that which you would prefer might depend on exactly what
> you are diffing. But I would also argue that in any case where the new
> code produces a worse result, the hunk header was not all that useful to
> begin with.
If the documented purpose of "diff -p" (and by proxy
diff.{type}.xfuncname) is to show the name of the *function*
containing the changed lines, and all you have is a list of lines
with no function names, it's pretty arbitrary to call either
behavior "worse". :-)
-tkc
next prev parent reply other threads:[~2012-08-25 0:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 12:57 misleading diff-hunk header Tim Chase
2012-08-21 15:22 ` Thomas Rast
2012-08-21 15:42 ` Tim Chase
2012-08-21 17:39 ` Johannes Sixt
2012-08-21 22:29 ` Junio C Hamano
2012-08-21 17:52 ` Junio C Hamano
2012-08-24 14:29 ` Jeff King
2012-08-24 15:05 ` Tim Chase
2012-08-24 16:44 ` Jeff King
2012-08-25 0:41 ` Tim Chase [this message]
2012-08-25 4:29 ` Junio C Hamano
2012-08-25 12:56 ` Tim Chase
2012-08-26 10:43 ` Stefano Lattarini
2012-08-26 18:53 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2012-08-21 13:21 Tim Chase
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50381F52.9030007@tim.thechases.com \
--to=git@tim$(echo .)thechases.com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox