mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Add "rev-list" program that uses the new time-based commit listing.
This is probably what you'd want to see for "git log".
This commit is contained in:
parent
6eb7ed5403
commit
64745109c4
2
Makefile
2
Makefile
|
@ -16,7 +16,7 @@ AR=ar
|
||||||
PROG= update-cache show-diff init-db write-tree read-tree commit-tree \
|
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 \
|
cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \
|
||||||
check-files ls-tree merge-base merge-cache unpack-file git-export \
|
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)
|
all: $(PROG)
|
||||||
|
|
||||||
|
|
23
rev-list.c
Normal file
23
rev-list.c
Normal file
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in a new issue