| 867 | } |
| 868 | |
| 869 | static 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 | |
| 914 | static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec, |
| 915 | int exc_std, int use_index) |
no test coverage detected