On Fri, Mar 14, 2014 at 07:56:46AM +0100, Johannes Sixt wrote:
> Consider this code:
>
> void above()
> {}
> static int Y;
> static int A;
> int bar()
> {
> return X;
> }
> void below()
> {}
Thanks, this example is very helpful.
> When you 'git grep --function-context X', then you get this output with
> the current pattern, you proposal, and my proposal (file name etc omitted
> for brevity):
>
> int bar()
> {
> return X;
> }
Right, that makes sense to me.
> When you 'git grep --function-context Y', what do you want to see? With
> the current pattern, and with your pattern that forbids semicolon we get:
>
> void above()
> {}
> static int Y;
> static int A;
>
> and with my simple pattern, which allows semicolon, we get merely
>
> static int Y;
>
> because the line itself is a hunk header (and we do not look back any
> further) and the next line is as well. That is not exactly "function
> context", and that is what I'm a bit worried about.
Hmm. To be honest, I do not see yours as all that bad. Is "above()" or
"A" actually interesting here? I'm not sure that they are. But then I do
not use --function-context myself.
I guess it violates the "show things that are vaguely nearby, rather
than a container" view of context that we discussed earlier. But somehow
that seems less important to me with "--function-context".
So I dunno. I kind of like your version.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html