summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6eb7ed5)
raw | patch | inline | side by side (parent: 6eb7ed5)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 24 Apr 2005 02:04:40 +0000 (19:04 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 24 Apr 2005 02:04:40 +0000 (19:04 -0700) |
This is probably what you'd want to see for "git log".
Makefile | patch | blob | history | |
rev-list.c | [new file with mode: 0644] | patch | blob |
diff --git a/Makefile b/Makefile
index 57afa8ecb5447be292144f4baac0575b8f00b56a..022af9b8c0a8ded65892c84bd419e46af6d2ae92 100644 (file)
--- a/Makefile
+++ b/Makefile
PROG= update-cache show-diff init-db write-tree read-tree commit-tree \
cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \
check-files ls-tree merge-base merge-cache unpack-file git-export \
- diff-cache convert-cache http-pull rpush rpull
+ diff-cache convert-cache http-pull rpush rpull rev-list
all: $(PROG)
diff --git a/rev-list.c b/rev-list.c
--- /dev/null
+++ b/rev-list.c
@@ -0,0 +1,23 @@
+#include "cache.h"
+#include "commit.h"
+
+int main(int argc, char **argv)
+{
+ unsigned char sha1[20];
+ struct commit_list *list = NULL;
+ struct commit *commit;
+
+ if (argc != 2 || get_sha1_hex(argv[1], sha1))
+ 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 {
+ struct commit *commit = pop_most_recent_commit(&list);
+ printf("%s\n", sha1_to_hex(commit->object.sha1));
+ } while (list);
+ return 0;
+}