X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=builtin-diff.c;h=6ac3d4b8ca23e7c4d724b22fd3222005d8fe3df8;hb=HEAD;hp=de81b05e32f884053060448bc59c83ff70961c24;hpb=12bb2035e9e28900a0a2ce36c5f38687a22c5157;p=git.git diff --git a/builtin-diff.c b/builtin-diff.c index de81b05e..6ac3d4b8 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -233,7 +233,7 @@ static int builtin_diff_combined(struct rev_info *revs, return 0; } -static void add_head(struct rev_info *revs) +void add_head(struct rev_info *revs) { unsigned char sha1[20]; struct object *obj; @@ -303,9 +303,9 @@ int cmd_diff(int argc, const char **argv, char **envp) obj = deref_tag(obj, NULL, 0); if (!obj) die("invalid object '%s' given.", name); - if (!strcmp(obj->type, commit_type)) + if (obj->type == TYPE_COMMIT) obj = &((struct commit *)obj)->tree->object; - if (!strcmp(obj->type, tree_type)) { + if (obj->type == TYPE_TREE) { if (ARRAY_SIZE(ent) <= ents) die("more than %d trees given: '%s'", (int) ARRAY_SIZE(ent), name); @@ -315,7 +315,7 @@ int cmd_diff(int argc, const char **argv, char **envp) ents++; continue; } - if (!strcmp(obj->type, blob_type)) { + if (obj->type == TYPE_BLOB) { if (2 <= blobs) die("more than two blobs given: '%s'", name); memcpy(blob[blobs].sha1, obj->sha1, 20);