- /* We allow people to feed us a commit object, just because we're nice */
- if (!strcmp(type, "commit")) {
- /* tree sha1 is always at offset 5 ("tree ") */
- if (get_sha1_hex(tree + 5, tree_sha1))
- die("bad commit object %s", argv[1]);
- free(tree);
- tree = read_sha1_file(tree_sha1, type, &size);
- if (!tree)
- die("unable to read tree object %s", sha1_to_hex(tree_sha1));
- }
-
- if (strcmp(type, "tree"))
- die("bad tree object %s (%s)", sha1_to_hex(tree_sha1), type);
-