From: Junio C Hamano <gitster@pobox.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Sverre Rabbelier <srabbelier@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH/RFC 0/4] grep: support to match by line number
Date: Mon, 02 May 2011 12:30:33 -0700 [thread overview]
Message-ID: <7vmxj4lx2e.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <BANLkTi=jABd5+_R-5SjhR163WV=TF1wbmQ@mail.gmail.com> (Bert Wesarg's message of "Mon, 2 May 2011 21:14:22 +0200")
Bert Wesarg <bert.wesarg@googlemail.com> writes:
> A build run will probably produce many warnings or errors (think of
> -j) for many files, so you need to handle more than one file. After
> the build run, you get a list of files which have warnings/errors,
> selecting one of the files will give you the original messages
> including the grep -@ output, from there you can select which message
> you want to consider opening in the editor, so grep -@ helps you in
> your decision what to open in your editor.
Now I got you talking ;-).
Wouldn't that workflow suggest that each invocation of -@ must be strongly
paired with each path? After all, your hello.c having an error at line 100
does not have much to do with which lines in your goodbye.c are buggy.
Which has larger implications by opening a big can of worms. Just a few
examples:
- Should "git grep -@1 -@3 foo bar" show line 1 of foo and line 3 of bar,
or should both lines 1 and 3 from both files be shown? Why would
anybody want to see line 3 of foo or line 1 of bar in such a case?
- Later part of command line arguments on standard git command set are
pathspecs, not necessarily individual paths. You could for example say
"git grep -@1 -@3 directory/". What should happen? Should the first
line of the first file in directory and the third line of the second
file in directory be shown? What would happen to the remaining files
in the directory/? You could replace "directory/" with "'*.c'".
Perhaps use of -@ need to tighten the command line parsing to make sure
that the user specified exact number of concrete filenames, not globs
nor leading path prefixes, and otherwise error out?
I like "this range from this file, that range from that file" as a
concept. It has far wider application than just in the context of "grep",
and I want to see us do it right from the beginning if we _were_ to design
it. That is why I am poking this discussion to make sure I can solicit
deep enough thinking from people in the design phase.
next prev parent reply other threads:[~2011-05-02 19:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 11:39 [PATCH/RFC 0/4] grep: support to match by line number Bert Wesarg
[not found] ` <cover.1304321122.git.bert.wesarg@googlemail.com>
2011-05-02 11:39 ` [PATCH/RFC 1/4] grep: prepare for re-using the space of the regexp member in struct grep_pat Bert Wesarg
2011-05-02 13:27 ` Thiago Farina
2011-05-02 14:25 ` Bert Wesarg
2011-05-02 11:39 ` [PATCH/RFC 2/4] grep: pass current line number down to match_one_pattern Bert Wesarg
2011-05-02 13:30 ` Thiago Farina
2011-05-02 14:29 ` Bert Wesarg
2011-05-02 16:40 ` Junio C Hamano
2011-05-02 11:39 ` [PATCH/RFC 3/4] grep: introduce pattern which matches at line number Bert Wesarg
2011-05-02 13:33 ` Thiago Farina
2011-05-02 14:32 ` Bert Wesarg
2011-05-02 11:39 ` [PATCH/RFC 4/4] grep: provide option to match " Bert Wesarg
2011-05-02 11:54 ` [PATCH/RFC 0/4] grep: support to match by " Sverre Rabbelier
2011-05-02 12:20 ` Bert Wesarg
2011-05-02 16:46 ` Junio C Hamano
2011-05-02 19:14 ` Bert Wesarg
2011-05-02 19:30 ` Junio C Hamano [this message]
2011-05-02 16:38 ` Junio C Hamano
2011-05-02 17:11 ` Jakub Narebski
2011-05-02 18:54 ` Bert Wesarg
2011-05-02 19:08 ` Junio C Hamano
2011-05-02 19:33 ` Bert Wesarg
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=7vmxj4lx2e.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bert.wesarg@googlemail.com \
--cc=git@vger.kernel.org \
--cc=srabbelier@gmail.com \
/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).