[PATCH] Add function to parse an object of unspecified type (take 2)
[git/dscho.git] / rev-list.c
blob77bfc29db1aad08ba9d7d87ce08d33d4a88e74e3
1 #include "cache.h"
2 #include "commit.h"
4 int main(int argc, char **argv)
6 unsigned char sha1[20];
7 struct commit_list *list = NULL;
8 struct commit *commit;
10 if (argc != 2 || get_sha1_hex(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;