]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/grep.c
Merge branch 'maint-2.1' into maint
[thirdparty/git.git] / builtin / grep.c
index c86a142f308d614daefd459fd9f9ddebe03f4cb8..4063882f06536ad5b3f1292a5b66e534ad4688af 100644 (file)
@@ -456,10 +456,10 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
 }
 
 static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
-                      struct object *obj, const char *name, struct object_context *oc)
+                      struct object *obj, const char *name, const char *path)
 {
        if (obj->type == OBJ_BLOB)
-               return grep_sha1(opt, obj->sha1, name, 0, oc ? oc->path : NULL);
+               return grep_sha1(opt, obj->sha1, name, 0, path);
        if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
                struct tree_desc tree;
                void *data;
@@ -501,7 +501,7 @@ static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
        for (i = 0; i < nr; i++) {
                struct object *real_obj;
                real_obj = deref_tag(list->objects[i].item, NULL, 0);
-               if (grep_object(opt, pathspec, real_obj, list->objects[i].name, list->objects[i].context)) {
+               if (grep_object(opt, pathspec, real_obj, list->objects[i].name, list->objects[i].path)) {
                        hit = 1;
                        if (opt->status_only)
                                break;
@@ -821,7 +821,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                        struct object *object = parse_object_or_die(sha1, arg);
                        if (!seen_dashdash)
                                verify_non_filename(prefix, arg);
-                       add_object_array_with_context(object, arg, &list, xmemdupz(&oc, sizeof(struct object_context)));
+                       add_object_array_with_path(object, arg, &list, oc.mode, oc.path);
                        continue;
                }
                if (!strcmp(arg, "--")) {