lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/6] grep: add option -p/--show-function
- Date: Wed, 01 Jul 2009 19:35:34 -0700
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH 5/6] grep: add option -p/--show-function
René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes:
> The new option -p instructs git grep to print the previous function
> definition as a context line, similar to diff -p. Such context lines
> are marked with an equal sign instead of a dash. This option
> complements the existing context options -A, -B, -C.
I have to say that I am a bit confused with these '==' markers.
$ ./git-grep -p -n -e pre_context -- '*.c'
builtin-grep.c=238=static int flush_grep(struct grep_opt *opt,
builtin-grep.c:288: if (opt->pre_context || opt->post_context ||...
==
builtin-grep.c=328=static int external_grep(struct grep_opt *opt, co...
builtin-grep.c:363: if (opt->post_context || opt->pre_context) {
builtin-grep.c:364: if (opt->post_context != opt->pre_co...
builtin-grep.c:365: if (opt->pre_context) {
builtin-grep.c:368: "%u"...
==
builtin-grep.c=586=static int context_callback(const struct option *...
Am I correct to say that '==' tells us that it has been showing the hits
in the previous function shown on the =$lineno= line, but now it will show
hits from a different function?
When used with -[ABC], it gets even confusing.
$ ./git-grep -C1 -p -n -e pre_context -- '*.c'
builtin-grep.c=238=static int flush_grep(struct grep_opt *opt,
--
builtin-grep.c-287-
builtin-grep.c:288: if (opt->pre_context || opt->post_context ||...
builtin-grep.c-289- /*
==
builtin-grep.c=328=static int external_grep(struct grep_opt *opt, co...
--
builtin-grep.c-362- push_arg("-c");
builtin-grep.c:363: if (opt->post_context || opt->pre_context) {
builtin-grep.c:364: if (opt->post_context != opt->pre_co...
builtin-grep.c:365: if (opt->pre_context) {
builtin-grep.c-366- push_arg("-B");
builtin-grep.c-367- len += snprintf(argp...
builtin-grep.c:368: "%u"...
builtin-grep.c-369- if (sizeof(randarg) ...
==
builtin-grep.c=586=static int context_callback(const struct option *...
--
What do "--" lines tell us in these cases? For example, does the first
one tells us that the -p output shown, which was from line 238, is outside
of the context of the hit it will show at line 288?
I am in no way complaining. My eyes are just not yet used to the output
format and are having hard time getting used to them and/or appreciating
how the separation these dividing lines give us is helpful.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html