Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-22 Thread Junio C Hamano
Duy Nguyen writes: >>> If cached is false and ce_ita() is true and either CE_VALID or >>> CE_SKIP_WORKTREE is set, we would continue to grep an _empty_ SHA-1. >>> But I think we should grep_file() instead, at least for CE_VALID. >> >> Yes, that is the breakage I noticed in the patch under discuss

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-22 Thread Duy Nguyen
On Wed, Jun 22, 2016 at 8:00 PM, Junio C Hamano wrote: > Duy Nguyen writes: > >>> So I wonder if a better change would be more like >>> >>> for (...) { >>> if (!S_ISREG(ce->ce_mode)) >>> continue; /* not a regular file */ >>> if (!ce

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-22 Thread Junio C Hamano
Duy Nguyen writes: >> So I wonder if a better change would be more like >> >> for (...) { >> if (!S_ISREG(ce->ce_mode)) >> continue; /* not a regular file */ >> if (!ce_path_match(ce, pathspec, NULL) >> contin

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-22 Thread Duy Nguyen
On Wed, Jun 22, 2016 at 12:49 AM, Junio C Hamano wrote: >> @@ -396,7 +396,7 @@ static int grep_cache(struct grep_opt *opt, const struct >> pathspec *pathspec, int >>* cache version instead >>*/ >> if (cached || (ce->ce_flags & CE_VALID) || >> ce_skip

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-22 Thread Duy Nguyen
On Wed, Jun 22, 2016 at 3:13 AM, Eric Sunshine wrote: > On Tue, Jun 21, 2016 at 5:14 PM, Charles Bailey wrote: >> From: Charles Bailey >> >> This reverts commit 4d552005323034c1d6311796ac1074e9a4b4b57e and adds an >> alternative fix to maintain the -L --cached behavior. > > It is common to provi

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-21 Thread Eric Sunshine
On Tue, Jun 21, 2016 at 5:14 PM, Charles Bailey wrote: > From: Charles Bailey > > This reverts commit 4d552005323034c1d6311796ac1074e9a4b4b57e and adds an > alternative fix to maintain the -L --cached behavior. It is common to provide some context along with the (shortened) commit ID. For instan

Re: [PATCH v2 2/2] grep: fix grepping for "intent to add" files

2016-06-21 Thread Junio C Hamano
Charles Bailey writes: > Is "Helped-by" an appropriate attribution in this case? Sure. > diff --git a/builtin/grep.c b/builtin/grep.c > index 462e607..ae73831 100644 > --- a/builtin/grep.c > +++ b/builtin/grep.c > @@ -386,7 +386,7 @@ static int grep_cache(struct grep_opt *opt, const struct > p