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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to