Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > --- > Documentation/git-grep.txt | 4 +++- > builtin-grep.c | 7 ++++++- > 2 files changed, 9 insertions(+), 2 deletions(-) I do not think you can call this "CE_VALID fixup". This is a possibly useful but nevertheless a new, different behaviour. We probably want opt->ignoreassumeunchanged in struct grep_opt, and control it via grep.ignoreassumeunchanged configuration, that perhaps defaults to true (i.e. "ignore"), with a command line override. Oh, and perhaps a shorter-and-sweeter name than "ignoreAssumeUnchanged". > diff --git a/builtin-grep.c b/builtin-grep.c > index ad0e0a5..55078cb 100644 > --- a/builtin-grep.c > +++ b/builtin-grep.c > @@ -455,6 +455,8 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached) > continue; > if (!pathspec_matches(paths, ce->name, opt->max_depth)) > continue; > + if (ce->ce_flags & CE_VALID) > + continue; The test probably should come before pathspec_matches(). > @@ -522,8 +524,11 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached, > continue; > hit |= grep_sha1(opt, ce->sha1, ce->name, 0); > } > - else > + else { > + if (ce->ce_flags & CE_VALID) > + continue; > hit |= grep_file(opt, ce->name); > + } > if (ce_stage(ce)) { > do { > nr++; I do not think the new code in this hunk will be reached as the other arm of the "else" greps in the index when CE_VALID is set. Has this series been tested or self-reviewed yet? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html