X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=rev-list.c;h=f3a989ccede991744061728532c25efbcb1716d5;hb=e464f4c3119b04712ab87329f3dd4d4f21b0a8a7;hp=8e4d83efba369c5ce925fd1e22d36a768917147b;hpb=d10ed827bcf5f07c173313d4575e1d6c720dc25f;p=git.git diff --git a/rev-list.c b/rev-list.c index 8e4d83ef..f3a989cc 100644 --- a/rev-list.c +++ b/rev-list.c @@ -7,9 +7,9 @@ #include "diff.h" #include "revision.h" -/* bits #0-4 in revision.h */ +/* bits #0-5 in revision.h */ -#define COUNTED (1u<<5) +#define COUNTED (1u<<6) static const char rev_list_usage[] = "git-rev-list [OPTION] ... [ -- paths... ]\n" @@ -40,13 +40,20 @@ static int bisect_list = 0; static int verbose_header = 0; static int abbrev = DEFAULT_ABBREV; static int show_parents = 0; +static int show_timestamp = 0; static int hdr_termination = 0; static const char *commit_prefix = ""; static enum cmit_fmt commit_format = CMIT_FMT_RAW; static void show_commit(struct commit *commit) { - printf("%s%s", commit_prefix, sha1_to_hex(commit->object.sha1)); + if (show_timestamp) + printf("%lu ", commit->date); + if (commit_prefix[0]) + fputs(commit_prefix, stdout); + if (commit->object.flags & BOUNDARY) + putchar('-'); + fputs(sha1_to_hex(commit->object.sha1), stdout); if (show_parents) { struct commit_list *parents = commit->parents; while (parents) { @@ -190,7 +197,7 @@ static int count_distance(struct commit_list *entry) if (commit->object.flags & (UNINTERESTING | COUNTED)) break; - if (!revs.paths || (commit->object.flags & TREECHANGE)) + if (!revs.prune_fn || (commit->object.flags & TREECHANGE)) nr++; commit->object.flags |= COUNTED; p = commit->parents; @@ -224,7 +231,7 @@ static struct commit_list *find_bisection(struct commit_list *list) nr = 0; p = list; while (p) { - if (!revs.paths || (p->item->object.flags & TREECHANGE)) + if (!revs.prune_fn || (p->item->object.flags & TREECHANGE)) nr++; p = p->next; } @@ -234,7 +241,7 @@ static struct commit_list *find_bisection(struct commit_list *list) for (p = list; p; p = p->next) { int distance; - if (revs.paths && !(p->item->object.flags & TREECHANGE)) + if (revs.prune_fn && !(p->item->object.flags & TREECHANGE)) continue; distance = count_distance(p); @@ -335,6 +342,10 @@ int main(int argc, const char **argv) show_parents = 1; continue; } + if (!strcmp(arg, "--timestamp")) { + show_timestamp = 1; + continue; + } if (!strcmp(arg, "--bisect")) { bisect_list = 1; continue; @@ -349,6 +360,9 @@ int main(int argc, const char **argv) (!(revs.tag_objects||revs.tree_objects||revs.blob_objects) && !revs.pending_objects)) usage(rev_list_usage); + save_commit_buffer = verbose_header; + track_object_refs = 0; + prepare_revision_walk(&revs); if (revs.tree_objects) mark_edges_uninteresting(revs.commits); @@ -356,9 +370,6 @@ int main(int argc, const char **argv) if (bisect_list) revs.commits = find_bisection(revs.commits); - save_commit_buffer = verbose_header; - track_object_refs = 0; - show_commit_list(&revs); return 0;