| 63 | } |
| 64 | |
| 65 | static int diff_tree_stdin(char *line) |
| 66 | { |
| 67 | int len = strlen(line); |
| 68 | struct object_id oid; |
| 69 | struct object *obj; |
| 70 | const char *p; |
| 71 | |
| 72 | if (!len || line[len-1] != '\n') |
| 73 | return -1; |
| 74 | line[len-1] = 0; |
| 75 | if (parse_oid_hex(line, &oid, &p)) |
| 76 | return -1; |
| 77 | obj = parse_object(the_repository, &oid); |
| 78 | if (!obj) |
| 79 | return -1; |
| 80 | if (obj->type == OBJ_COMMIT) |
| 81 | return stdin_diff_commit((struct commit *)obj, p); |
| 82 | if (obj->type == OBJ_TREE) |
| 83 | return stdin_diff_trees((struct tree *)obj, p); |
| 84 | error("Object %s is a %s, not a commit or tree", |
| 85 | oid_to_hex(&oid), type_name(obj->type)); |
| 86 | return -1; |
| 87 | } |
| 88 | |
| 89 | static const char diff_tree_usage[] = |
| 90 | "git diff-tree [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]\n" |
no test coverage detected