Merge branch 'mt/grep-sparse-checkout'
"git grep" has been tweaked to be limited to the sparse checkout paths. * mt/grep-sparse-checkout: grep: honor sparse-checkout on working tree searches
This commit is contained in:
@ -506,6 +506,10 @@ static int grep_cache(struct grep_opt *opt,
|
||||
|
||||
for (nr = 0; nr < repo->index->cache_nr; nr++) {
|
||||
const struct cache_entry *ce = repo->index->cache[nr];
|
||||
|
||||
if (!cached && ce_skip_worktree(ce))
|
||||
continue;
|
||||
|
||||
strbuf_setlen(&name, name_base_len);
|
||||
strbuf_addstr(&name, ce->name);
|
||||
|
||||
@ -518,8 +522,7 @@ static int grep_cache(struct grep_opt *opt,
|
||||
* cache entry are identical, even if worktree file has
|
||||
* been modified, so use cache version instead
|
||||
*/
|
||||
if (cached || (ce->ce_flags & CE_VALID) ||
|
||||
ce_skip_worktree(ce)) {
|
||||
if (cached || (ce->ce_flags & CE_VALID)) {
|
||||
if (ce_stage(ce) || ce_intent_to_add(ce))
|
||||
continue;
|
||||
hit |= grep_oid(opt, &ce->oid, name.buf,
|
||||
|
||||
Reference in New Issue
Block a user