Skip to content

Commit dc68c4f

Browse files
author
Junio C Hamano
committed
rev-list --timestamp
This prefixes the raw commit timestamp to the output. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 3103cf9 commit dc68c4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

rev-list.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ static int bisect_list = 0;
4040
static int verbose_header = 0;
4141
static int abbrev = DEFAULT_ABBREV;
4242
static int show_parents = 0;
43+
static int show_timestamp = 0;
4344
static int hdr_termination = 0;
4445
static const char *commit_prefix = "";
4546
static enum cmit_fmt commit_format = CMIT_FMT_RAW;
4647

4748
static void show_commit(struct commit *commit)
4849
{
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);
5055
if (show_parents) {
5156
struct commit_list *parents = commit->parents;
5257
while (parents) {
@@ -335,6 +340,10 @@ int main(int argc, const char **argv)
335340
show_parents = 1;
336341
continue;
337342
}
343+
if (!strcmp(arg, "--timestamp")) {
344+
show_timestamp = 1;
345+
continue;
346+
}
338347
if (!strcmp(arg, "--bisect")) {
339348
bisect_list = 1;
340349
continue;

0 commit comments

Comments
 (0)