git-tar-tree: no more void pointer arithmetic
[git.git] / builtin-grep.c
index acc4eea..9806499 100644 (file)
@@ -459,6 +459,8 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
                push_arg("-n");
        if (opt->regflags & REG_EXTENDED)
                push_arg("-E");
+       if (opt->regflags & REG_ICASE)
+               push_arg("-i");
        if (opt->word_regexp)
                push_arg("-w");
        if (opt->name_only)
@@ -628,10 +630,9 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
 static int grep_object(struct grep_opt *opt, const char **paths,
                       struct object *obj, const char *name)
 {
-       if (!strcmp(obj->type, blob_type))
+       if (obj->type == TYPE_BLOB)
                return grep_sha1(opt, obj->sha1, name);
-       if (!strcmp(obj->type, commit_type) ||
-           !strcmp(obj->type, tree_type)) {
+       if (obj->type == TYPE_COMMIT || obj->type == TYPE_TREE) {
                struct tree_desc tree;
                void *data;
                int hit;
@@ -644,7 +645,7 @@ static int grep_object(struct grep_opt *opt, const char **paths,
                free(data);
                return hit;
        }
-       die("unable to grep from object of type %s", obj->type);
+       die("unable to grep from object of type %s", typename(obj->type));
 }
 
 static const char builtin_grep_usage[] =