git-tar-tree: no more void pointer arithmetic
[git.git] / builtin-diff.c
index b0c9cad..6ac3d4b 100644 (file)
@@ -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);