diff --git a/builtin-grep.c b/builtin-grep.c
index 5fac5701e6ccebdbe83b00d2e2df19343d3aea0e..9806499263dcb92c7a6903ead36646baf676b178 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
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;
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[] =