aboutsummaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-23 19:04:40 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-23 19:04:40 -0700
commit64745109c41a5c4a66b9e3df6bca2fd4abf60d48 (patch)
tree2b7d1d2f747a63f2270c7062ffd0726b369ca25e /rev-list.c
parent6eb7ed5403b7d57d5ed7e30d0cd0b312888ee95c (diff)
downloadgit-64745109c41a5c4a66b9e3df6bca2fd4abf60d48.tar.gz
git-64745109c41a5c4a66b9e3df6bca2fd4abf60d48.tar.xz
Add "rev-list" program that uses the new time-based commit listing.
This is probably what you'd want to see for "git log".
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/rev-list.c b/rev-list.c
new file mode 100644
index 000000000..1c797d24a
--- /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;
+}