X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=builtin-diff.c;h=6ac3d4b8ca23e7c4d724b22fd3222005d8fe3df8;hp=b0c9cade02fef6d71bf45dd2fceb6d573778195e;hb=HEAD;hpb=3b4fd63f72cb19288d23c9622366bbe32e55613f diff --git a/builtin-diff.c b/builtin-diff.c index b0c9cade..6ac3d4b8 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -122,7 +122,7 @@ static int builtin_diff_b_f(struct rev_info *revs, stuff_change(&revs->diffopt, canon_mode(st.st_mode), canon_mode(st.st_mode), blob[0].sha1, null_sha1, - blob[0].name, path); + path, path); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); return 0; @@ -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);