1#include "cache.h"
2#include "commit.h"
3
4int main(int argc, char **argv)
5{
6 unsigned char sha1[20];
7 struct commit_list *list = NULL;
8 struct commit *commit;
9
10 if (argc != 2 || get_sha1_hex(argv[1], sha1))
11 usage("rev-list <commit-id>");
12
13 commit = lookup_commit(sha1);
14 if (!commit || parse_commit(commit) < 0)
15 die("bad commit object");
16
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}