MCPcopy Index your code
hub / github.com/git/git / grep_objects

Function grep_objects

builtin/grep.c:869–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
870 const struct object_array *list)
871{
872 unsigned int i;
873 int hit = 0;
874 const unsigned int nr = list->nr;
875
876 prefetch_grep_blobs(opt, pathspec, list);
877
878 for (i = 0; i < nr; i++) {
879 struct object *real_obj;
880
881 obj_read_lock();
882 real_obj = deref_tag(opt->repo, list->objects[i].item,
883 NULL, 0);
884 obj_read_unlock();
885
886 if (!real_obj) {
887 char hex[GIT_MAX_HEXSZ + 1];
888 const char *name = list->objects[i].name;
889
890 if (!name) {
891 oid_to_hex_r(hex, &list->objects[i].item->oid);
892 name = hex;
893 }
894 die(_("invalid object '%s' given."), name);
895 }
896
897 /* load the gitmodules file for this rev */
898 if (recurse_submodules) {
899 submodule_free(opt->repo);
900 obj_read_lock();
901 gitmodules_config_oid(&real_obj->oid);
902 obj_read_unlock();
903 }
904 if (grep_object(opt, pathspec, real_obj, list->objects[i].name,
905 list->objects[i].path)) {
906 hit = 1;
907 if (opt->status_only)
908 break;
909 }
910 }
911 return hit;
912}
913
914static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
915 int exc_std, int use_index)

Callers 1

cmd_grepFunction · 0.85

Calls 9

prefetch_grep_blobsFunction · 0.85
obj_read_lockFunction · 0.85
deref_tagFunction · 0.85
obj_read_unlockFunction · 0.85
oid_to_hex_rFunction · 0.85
submodule_freeFunction · 0.85
gitmodules_config_oidFunction · 0.85
grep_objectFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected