git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 5/6] grep: add option -p/--show-function
Date: Wed, 01 Jul 2009 19:35:34 -0700	[thread overview]
Message-ID: <7vbpo3errd.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4A4BDDEA.3030005@lsrfire.ath.cx> ("René Scharfe"'s message of "Thu\, 02 Jul 2009 00\:06\:34 +0200")

René Scharfe <rene.scharfe@lsrfire.ath.cx> 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.

  reply	other threads:[~2009-07-02  2:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01 22:00 [PATCH 0/6] grep: add option -p/--show-function, similar to diff's René Scharfe
2009-07-01 22:01 ` [PATCH 1/6] userdiff: add xdiff_clear_find_func() René Scharfe
2009-07-01 22:02 ` [PATCH 2/6] grep: move context hunk mark handling into show_line() René Scharfe
2009-07-01 22:55   ` Junio C Hamano
2009-07-02  3:15     ` René Scharfe
2009-07-02  5:24       ` Junio C Hamano
2009-07-01 22:03 ` [PATCH 3/6] grep: print context hunk marks between files René Scharfe
2009-07-01 22:05 ` [PATCH 4/6] grep: handle pre context lines on demand René Scharfe
2009-07-01 22:06 ` [PATCH 5/6] grep: add option -p/--show-function René Scharfe
2009-07-02  2:35   ` Junio C Hamano [this message]
2009-07-02  4:38     ` René Scharfe
2009-07-02  5:27       ` Junio C Hamano
2009-07-02  6:16         ` René Scharfe
2009-07-02 15:42           ` René Scharfe
2009-07-01 22:07 ` [PATCH 6/6] grep -p: support user defined regular expressions René Scharfe

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=7vbpo3errd.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /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).