git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* xfuncname problems with C++
@ 2015-01-02 16:49 Robert Dailey
  2015-01-02 17:03 ` Robert Dailey
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Robert Dailey @ 2015-01-02 16:49 UTC (permalink / raw)
  To: Git

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-02 22:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).