Code

Make "cat-file" use "read_object_with_reference()"
[git.git] / rev-list.c
1 #include "cache.h"
2 #include "commit.h"
4 int main(int argc, char **argv)
5 {
6         unsigned char sha1[20];
7         struct commit_list *list = NULL;
8         struct commit *commit;
10         if (argc != 2 || get_sha1(argv[1], sha1))
11                 usage("rev-list <commit-id>");
13         commit = lookup_commit(sha1);
14         if (!commit || parse_commit(commit) < 0)
15                 die("bad commit object");
17         commit_list_insert(commit, &list);
18         do {
19                 struct commit *commit = pop_most_recent_commit(&list, 0x1);
20                 printf("%s\n", sha1_to_hex(commit->object.sha1));
21         } while (list);
22         return 0;
23 }