From: Jeff King <peff@peff.net>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 1bis/2] Diff patterns for POSIX shells
Date: Wed, 3 Aug 2011 03:32:52 -0600 [thread overview]
Message-ID: <20110803093252.GA16351@sigill.intra.peff.net> (raw)
In-Reply-To: <1312349176-20984-1-git-send-email-giuseppe.bilotta@gmail.com>
On Wed, Aug 03, 2011 at 07:26:16AM +0200, Giuseppe Bilotta wrote:
> All diffs following a function definition will have that function name
> as chunck header, but this is the best we can do with the current
> userdiff capabilities.
Curious as to how this would look in git.git, I tried "git log -p"
before and after your patches, and diffed the result. I noticed two
things:
1. Given a block of shell code like this:
foo() {
... do something ...
}
test_expect_success 'test foo' '
... the actual test ...
'
if we add new code after the test, the old regex would print:
@@ -1,2 +3,4 @@ test_expect_success 'test foo' '
and now we say:
@@ -1,2 +3,4 @@ foo
which seems more misleading. I know the function-matching code has
no way to say "look for ^}, which signals end of function", so we
can't be entirely accurate. But I wonder if the new heuristic
(which seems to look for a name followed by parentheses) is
actually any better than the old.
2. What would have printed before:
@@ -1,2 +3,4 @@ foo() {
now prints
@@ -1,2 +3,4 @@ foo
without the parentheses or brace. It looks like the similar C one
keeps the parentheses, at least. I find that a bit more readable,
as it is more clear that the line indicates a function, and not
simply some top-level command.
-Peff
next prev parent reply other threads:[~2011-08-03 9:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 10:37 [PATCH 0/2] Minor userdiff stuff Giuseppe Bilotta
2011-08-01 10:37 ` [PATCH 1/2] Diff patterns for POSIX shells Giuseppe Bilotta
2011-08-02 17:51 ` Junio C Hamano
2011-08-02 18:52 ` Giuseppe Bilotta
2011-08-03 5:26 ` [PATCH 1bis/2] " Giuseppe Bilotta
2011-08-03 9:32 ` Jeff King [this message]
2011-08-03 10:12 ` Giuseppe Bilotta
2011-08-03 18:53 ` Junio C Hamano
2011-08-01 10:37 ` [PATCH 2/2] Use specific diff rules for repo files Giuseppe Bilotta
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=20110803093252.GA16351@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=giuseppe.bilotta@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).