Re: [WIP/RFH/RFD/PATCH] grep: allow to use textconv filters
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 4, 2013, 17:12 UTC
- Message-ID
- <7vtxps2eb2.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <2c0641ea4df6a872a4466efe0c0124f304f44c3e.1359991521.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 21 quoted lines
> Recently and not so recently, we made sure that log/grep type operations > use textconv filters when a userfacing diff would do the same: > > ef90ab6 (pickaxe: use textconv for -S counting, 2012-10-28) > b1c2f57 (diff_grep: use textconv buffers for add/deleted files, 2012-10-28) > 0508fe5 (combine-diff: respect textconv attributes, 2011-05-23) > > "git grep" currently does not use textconv filters at all, that is > neither for displaying the match and context nor for the actual grepping. > > Introduce a binary mode "--textconv" (in addition to "--text" and "-I") > which makes git grep use any configured textconv filters for grepping > and output purposes. > > Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> > --- > > Notes: > I'm somehow stuck in textconv/filespec/... hell, so I'm sending this out > in request for help. I'm sure there are people for whom it's a breeze to > get this right.
Looks like the patch touches the right places in the codepaths that need to be updated from a quick read.
> The difficulty is in getting the different cases (blob/sha1 vs. > worktree) right, and in making the changes minimally invasive.
I think grep_source abstraction was intended to be a way for that, and if what it gives you is not sufficient for your needs, extending it should not be seen as "invasive" at all.