MCPcopy Create free account
hub / github.com/git/git / grep_file

Function grep_file

builtin/grep.c:389–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389static int grep_file(struct grep_opt *opt, const char *filename)
390{
391 struct strbuf buf = STRBUF_INIT;
392 struct grep_source gs;
393
394 grep_source_name(opt, filename, 0, &buf);
395 grep_source_init_file(&gs, buf.buf, filename);
396 strbuf_release(&buf);
397
398 if (num_threads > 1) {
399 /*
400 * add_work() copies gs and thus assumes ownership of
401 * its fields, so do not call grep_source_clear()
402 */
403 add_work(opt, &gs);
404 return 0;
405 } else {
406 int hit;
407
408 hit = grep_source(opt, &gs);
409
410 grep_source_clear(&gs);
411 return hit;
412 }
413}
414
415static void append_path(struct grep_opt *opt, const void *data, size_t len)
416{

Callers 2

grep_cacheFunction · 0.85
grep_directoryFunction · 0.85

Calls 6

grep_source_nameFunction · 0.85
grep_source_init_fileFunction · 0.85
strbuf_releaseFunction · 0.85
add_workFunction · 0.85
grep_source_clearFunction · 0.85
grep_sourceClass · 0.70

Tested by

no test coverage detected