@matheusbsbs / matheus-bagliano / commits / dc68c4fff4
Fork 0

rev-list --timestamp

This prefixes the raw commit timestamp to the output. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 22, 2006 at 00:22 UTC dc68c4fff4cd007d840193ebb11ef1f31a779c75
1 file changed +10 -1
rev-list.c
+10 -1
@@ -40,13 +40,18 @@ static int bisect_list = 0;
40 static int verbose_header = 0;
41 static int abbrev = DEFAULT_ABBREV;
42 static int show_parents = 0;
43 +static int show_timestamp = 0;
44 static int hdr_termination = 0;
45 static const char *commit_prefix = "";
46 static enum cmit_fmt commit_format = CMIT_FMT_RAW;
47
48 static void show_commit(struct commit *commit)
49 {
49 - printf("%s%s", commit_prefix, sha1_to_hex(commit->object.sha1));
50 + if (show_timestamp)
51 + printf("%lu ", commit->date);
52 + if (commit_prefix[0])
53 + fputs(commit_prefix, stdout);
54 + fputs(sha1_to_hex(commit->object.sha1), stdout);
55 if (show_parents) {
56 struct commit_list *parents = commit->parents;
57 while (parents) {
@@ -335,6 +340,10 @@ int main(int argc, const char **argv)
340 show_parents = 1;
341 continue;
342 }
343 + if (!strcmp(arg, "--timestamp")) {
344 + show_timestamp = 1;
345 + continue;
346 + }
347 if (!strcmp(arg, "--bisect")) {
348 bisect_list = 1;
349 continue;