Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-18 Thread Taylor Blau
On Fri, May 18, 2018 at 02:50:21PM -0700, Taylor Blau wrote: > [...] > > > Another might be to pick "foo" in the first and "bar" in the second > > line, as that is the "first hit" on the line, which is consistent > > with how "git grep -e foo" would say about "a foo b foo c foo" (I > > expect that

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-18 Thread Taylor Blau
Thanks for your thoughtful response. I answered in detail below, but I think that we're in agreement about the semantics, with a few corrections on my part. I'd like to push forward with this series, including the proposed changes below, but feel that sending it as v7 would be asking too much of a

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-18 Thread Junio C Hamano
Taylor Blau writes: > * `git grep --and -e foo -e bar`. This binary operation should recur > on its sub-expressions and take the minimum of the starting offset > and the maximum of the ending offset. We use infix notation, so the above is "git grep -e foo --and -e

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-17 Thread Taylor Blau
On Sat, May 12, 2018 at 03:07:04PM +0900, Junio C Hamano wrote: > Taylor Blau writes: > > > I re-read your note and understand more clearly now what your suggestion > > is. To ensure that we're in agreement, do you mean: > > > > 1. '--column -v' will _never_ give a column,

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-12 Thread Junio C Hamano
Taylor Blau writes: > I re-read your note and understand more clearly now what your suggestion > is. To ensure that we're in agreement, do you mean: > > 1. '--column -v' will _never_ give a column, but will never die(), > either No, I don't. > 2. '--column --[and |

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-11 Thread Taylor Blau
On Sat, May 12, 2018 at 02:08:48PM +0900, Junio C Hamano wrote: > Taylor Blau writes: > > >> $ git grep -v second > >> $ git grep --not -e second > >> > >> may hit all lines in this message (except for the obvious two > >> lines), but we cannot say which column we found

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-11 Thread Junio C Hamano
Taylor Blau writes: >> $ git grep -v second >> $ git grep --not -e second >> >> may hit all lines in this message (except for the obvious two >> lines), but we cannot say which column we found a hit. I am >> wondering if it is too grave a sin to report "the whole line

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-11 Thread Taylor Blau
On Thu, May 10, 2018 at 09:04:34AM +0900, Junio C Hamano wrote: > Taylor Blau writes: > > > This check we should retain and change the wording to mention '--and', > > '--or', and '--not' specifically. > > Why are these problematic in the first place? If I said > > $ git

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-10 Thread Junio C Hamano
René Scharfe writes: > Am 10.05.2018 um 02:04 schrieb Junio C Hamano: > ... >> $ git grep -v second >> $ git grep --not -e second >> >> may hit all lines in this message (except for the obvious two >> lines), but we cannot say which column we found a hit. I am >>

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread René Scharfe
Am 10.05.2018 um 02:04 schrieb Junio C Hamano: > Taylor Blau writes: > >> This check we should retain and change the wording to mention '--and', >> '--or', and '--not' specifically. > > Why are these problematic in the first place? If I said > > $ git grep -e first

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Junio C Hamano
Taylor Blau writes: > This check we should retain and change the wording to mention '--and', > '--or', and '--not' specifically. Why are these problematic in the first place? If I said $ git grep -e first --and -e these $ git grep -e first --and --not -e those $

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Taylor Blau
On Wed, May 09, 2018 at 07:26:57PM +0200, Martin Ågren wrote: > On 9 May 2018 at 12:41, Phillip Wood wrote: > > On 09/05/18 03:13, Taylor Blau wrote: > >> > >> +--column:: > >> + Prefix the 1-indexed byte-offset of the first match on non-context > >> lines. This

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Taylor Blau
On Wed, May 09, 2018 at 11:41:02AM +0100, Phillip Wood wrote: > Hi Taylor > > On 09/05/18 03:13, Taylor Blau wrote: > > Teach 'git-grep(1)' a new option, '--column', to show the column > > number of the first match on a non-context line. This makes it possible > > to teach

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Taylor Blau
On Wed, May 09, 2018 at 06:17:20PM +0200, Duy Nguyen wrote: > On Wed, May 9, 2018 at 4:13 AM, Taylor Blau wrote: > > diff --git a/builtin/grep.c b/builtin/grep.c > > index 5f32d2ce84..f9f516dfc4 100644 > > --- a/builtin/grep.c > > +++ b/builtin/grep.c > > @@ -829,6 +829,7 @@

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Martin Ågren
On 9 May 2018 at 12:41, Phillip Wood wrote: > On 09/05/18 03:13, Taylor Blau wrote: >> >> +--column:: >> + Prefix the 1-indexed byte-offset of the first match on non-context >> lines. This >> + option is incompatible with '--invert-match', and extended >>

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Duy Nguyen
On Wed, May 9, 2018 at 4:13 AM, Taylor Blau wrote: > diff --git a/builtin/grep.c b/builtin/grep.c > index 5f32d2ce84..f9f516dfc4 100644 > --- a/builtin/grep.c > +++ b/builtin/grep.c > @@ -829,6 +829,7 @@ int cmd_grep(int argc, const char **argv, const char > *prefix) >

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-09 Thread Phillip Wood
Hi Taylor On 09/05/18 03:13, Taylor Blau wrote: Teach 'git-grep(1)' a new option, '--column', to show the column number of the first match on a non-context line. This makes it possible to teach 'contrib/git-jump/git-jump' how to seek to the first matching position of a grep match in your

[PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

2018-05-08 Thread Taylor Blau
Teach 'git-grep(1)' a new option, '--column', to show the column number of the first match on a non-context line. This makes it possible to teach 'contrib/git-jump/git-jump' how to seek to the first matching position of a grep match in your editor, and allows similar additional scripting