From: Jeff King <peff@peff.net>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: git@vger.kernel.org, Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH 2/4] xdiff-interface.c: always trim trailing space from xfuncname matches
Date: Thu, 9 Sep 2010 15:35:28 -0400 [thread overview]
Message-ID: <20100909193528.GA1092@sigill.intra.peff.net> (raw)
In-Reply-To: <GLdpD2WwjdTYfjYpj9FXho_K_YzeaiL1jdGACbdsXplUz5EPC0X3vA@cipher.nrlssc.navy.mil>
On Thu, Sep 09, 2010 at 02:33:15PM -0500, Brandon Casey wrote:
> On 09/09/2010 02:21 PM, Jeff King wrote:
> > On Thu, Sep 09, 2010 at 02:02:46PM -0500, Brandon Casey wrote:
> >
> >> From: Brandon Casey <drafnel@gmail.com>
> >>
> >> Generally, trailing space is removed from the string matched by the
> >> xfuncname patterns. The exception is when the matched string exceeds the
> >> length of the fixed-size buffer that it will be copied in to. But, a
> >> string that exceeds the buffer can still contain trailing space in the
> >> portion of the string that will be copied into the buffer. So, simplify
> >> this code slightly, and just perform the trailing space removal always.
> >
> > Hrm. So we are cutting off trailing space that might have been
> > non-trailing space in their original string? It is hard to argue that is
> > much worse than truncating the original string in the first place. But I
> > really wonder whether we should be silently truncating anything, and not
> > just dying or somehow handling this better?
> >
> > If I understand what is going on (and I'm not sure that I do), are we
> > silently producing bogus word-diffs in the face of really long lines?
>
> I don't think this function is used to do the word-diffs. Unless I'm
> missing something, ff_regexp is only used to do the funcname matching to
> produce the hunk header string. An 80-byte buffer is used to hold
> that string. So, the trimming is performed on what is effectively a
> comment.
Ah, OK, that makes a lot more sense. Then yeah, we should always be
trimming trailing whitespace from the result, so your patch is good.
-Peff
next prev parent reply other threads:[~2010-09-09 19:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 19:02 [PATCH 1/4] diff.c: call regfree to free memory allocated by regcomp when necessary Brandon Casey
2010-09-09 19:02 ` [PATCH 2/4] xdiff-interface.c: always trim trailing space from xfuncname matches Brandon Casey
2010-09-09 19:21 ` Jeff King
2010-09-09 19:33 ` Brandon Casey
2010-09-09 19:35 ` Jeff King [this message]
2010-09-09 19:02 ` [PATCH 3/4] t/t4018: test whether the word_regex patterns compile Brandon Casey
2010-09-09 19:23 ` Jeff King
2010-09-09 19:39 ` Brandon Casey
2010-09-09 19:59 ` Jeff King
2010-09-10 16:13 ` [PATCH] t/t4018: avoid two unnecessary sub-shell invocations Brandon Casey
2010-09-10 17:25 ` Ævar Arnfjörð Bjarmason
2010-09-09 19:02 ` [PATCH 4/4] userdiff.c: add builtin fortran regex patterns Brandon Casey
2010-09-09 19:25 ` Jeff King
2010-09-09 19:41 ` Brandon Casey
2010-09-10 16:18 ` [PATCH 4/4 v2] " Brandon Casey
2010-09-09 19:15 ` [PATCH 1/4] diff.c: call regfree to free memory allocated by regcomp when necessary Jeff King
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=20100909193528.GA1092@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
/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).