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

Function grep_oid

builtin/grep.c:361–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359}
360
361static int grep_oid(struct grep_opt *opt, const struct object_id *oid,
362 const char *filename, int tree_name_len,
363 const char *path)
364{
365 struct strbuf pathbuf = STRBUF_INIT;
366 struct grep_source gs;
367
368 grep_source_name(opt, filename, tree_name_len, &pathbuf);
369 grep_source_init_oid(&gs, pathbuf.buf, path, oid, opt->repo);
370 strbuf_release(&pathbuf);
371
372 if (num_threads > 1) {
373 /*
374 * add_work() copies gs and thus assumes ownership of
375 * its fields, so do not call grep_source_clear()
376 */
377 add_work(opt, &gs);
378 return 0;
379 } else {
380 int hit;
381
382 hit = grep_source(opt, &gs);
383
384 grep_source_clear(&gs);
385 return hit;
386 }
387}
388
389static int grep_file(struct grep_opt *opt, const char *filename)
390{

Callers 3

grep_cacheFunction · 0.85
grep_treeFunction · 0.85
grep_objectFunction · 0.85

Calls 6

grep_source_nameFunction · 0.85
grep_source_init_oidFunction · 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