git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Robert Dailey <rcdailey.lists@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: xfuncname problems with C++
Date: Fri, 02 Jan 2015 21:25:26 +0100	[thread overview]
Message-ID: <54A6FEB6.40305@kdbg.org> (raw)
In-Reply-To: <CAHd499Cn8C51i_+Dm4h_U4X_Jc-nhNMjoufiZRdn5LGxFqD_HA@mail.gmail.com>

Am 02.01.2015 um 17:49 schrieb Robert Dailey:
> I have a function like so:
> 
> void MyClass::SomeFunction(int someParameter)
> {
>     // Stuff changed in here
> }
> 
> When I do `git diff` on the file containing this function, I get a
> chunk showing some changed code in this function somewhere in the
> middle of the body. However, the chunk header shows my root namespace
> name in the file instead of the function header:
> 
> @@ -144,15 +149,22 @@ namespace Utils
> 
> What I expect to see:
> 
> @@ -144,15 +149,22 @@ void MyClass::SomeFunction(int someParameter)
> 
> I've tried various regular expressions that work in regex testers I
> use against this function signature, however they do not work when I
> apply them to my config:
> 
> [diff "cpp"]
>     xfuncname =
> "^\\s*[\\w_][\\w\\d_]*\\s*.*\\s*[\\w_][\\w\\d_]*\\s*\\(.*\\)\\s*$"
> 
> File name is "foo.cpp", I even added it to my git attributes file:
> 
> *.cpp diff=cpp
> 
> Using the regex above, my chunk headers come back blank. Why is it
> showing namespace? How do I make this match the nearest function
> header?
> 

Is the line that contains 'void MyClass::...' before line 149? Does the
word 'void' begin at the left-most column?

-- Hannes

      parent reply	other threads:[~2015-01-02 20:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 16:49 xfuncname problems with C++ Robert Dailey
2015-01-02 17:03 ` Robert Dailey
2015-01-02 20:31   ` Johannes Sixt
2015-01-02 21:27     ` Robert Dailey
2015-01-02 22:05       ` Jonathan Nieder
2015-01-02 20:19 ` Jonathan Nieder
2015-01-02 20:25 ` Johannes Sixt [this message]

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=54A6FEB6.40305@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=rcdailey.lists@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).