Re: [PATCHv2 7/7] git grep: honor textconv by default

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCHv2 7/7] git grep: honor textconv by default

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:59

Matthieu Moy [off-list ref] writes:
Grepping through the binary, on the other hand, can very well make
sense, like:

$ git grep foo
file.txt: some instance of foo
binary file bar.bin matches
Yes, 

I am moderately negative on making it the default, mostly because it
goes against established expectations, but I did not mean to say
that an ability to pass blob contents through textconv before
running grep should not exist.  It would be a good option to have.

Re: [PATCHv2 7/7] git grep: honor textconv by default

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:57:01

Junio C Hamano venit, vidit, dixit 24.04.2013 20:55:
Matthieu Moy [off-list ref] writes:
quoted
Grepping through the binary, on the other hand, can very well make
sense, like:

$ git grep foo
file.txt: some instance of foo
binary file bar.bin matches
BTW, textconv does not have to be slow - just use textconv-cache.
Yes, 

I am moderately negative on making it the default, mostly because it
goes against established expectations, but I did not mean to say
that an ability to pass blob contents through textconv before
running grep should not exist.  It would be a good option to have.
I'm still looking for a way to at least treat "git grep" and "git show
blob" the same way. I understand that I cannot convince you to change
the default here. The two options that I see are:

- Implement the --textconv option but leave the default as is. I did
that for "git grep" already (just drop 7/7) but it seems to be
cumbersome for "git show blob". I have to recheck.

- Implement a new attribute "show" analogous to "diff" which applies to
the blob case ("git grep" is a blob case, and so is "git show blob")
which can specify a "show" driver, which is like a "diff" driver but
understands textconv and cachetextconv options only.
Here, the default would be "--textconv" in any case, but unless you
specify a "show" attribute and driver there is no change in current
behavior.

The second case is a bit like clean/smudge, so, alternatively, one could
add a textconv and cachetextconv option to "filter" rather than
introducing "show". I'm not sure how much the textconv machinery needs
to change, though.

Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help