2005-04-24 10:04:40 +08:00
|
|
|
#include "cache.h"
|
|
|
|
#include "commit.h"
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
unsigned char sha1[20];
|
|
|
|
struct commit_list *list = NULL;
|
|
|
|
struct commit *commit;
|
|
|
|
|
2005-05-02 07:36:56 +08:00
|
|
|
if (argc != 2 || get_sha1(argv[1], sha1))
|
2005-04-24 10:04:40 +08:00
|
|
|
usage("rev-list <commit-id>");
|
|
|
|
|
|
|
|
commit = lookup_commit(sha1);
|
|
|
|
if (!commit || parse_commit(commit) < 0)
|
|
|
|
die("bad commit object");
|
|
|
|
|
|
|
|
commit_list_insert(commit, &list);
|
|
|
|
do {
|
2005-04-24 11:29:22 +08:00
|
|
|
struct commit *commit = pop_most_recent_commit(&list, 0x1);
|
2005-04-24 10:04:40 +08:00
|
|
|
printf("%s\n", sha1_to_hex(commit->object.sha1));
|
|
|
|
} while (list);
|
|
|
|
return 0;
|
|
|
|
}
|