commit - 4cac2b4e3f60c45b2a6550d4b15730d172eab925
commit + d91e053539d7b792ea587fe510d514642396db55
blob - f8f629aca02cc89d790c9c76f79a3a2704601f97
blob + b5cc0d766589d88610458ba52595511cd0f39987
--- got/got.c
+++ got/got.c
char *ref_str = NULL, *id_str = NULL, *logmsg0 = NULL;
char *comma, *s, *nl;
struct got_reflist_head *refs;
+ char datebuf[12]; /* YYYY-MM-DD + SPACE + NUL */
+ struct tm tm;
+ time_t committer_time;
refs = got_reflist_object_id_map_lookup(refs_idmap, id);
if (refs) {
return err;
}
+ committer_time = got_object_commit_get_committer_time(commit);
+ if (gmtime_r(&committer_time, &tm) == NULL)
+ return got_error_from_errno("gmtime_r");
+ if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d ", &tm) == 0)
+ return got_error(GOT_ERR_NO_SPACE);
+
err = got_object_commit_get_logmsg(&logmsg0, commit);
if (err)
goto done;
}
if (ref_str)
- printf("%-7s %s\n", ref_str, s);
+ printf("%s%-7s %s\n", datebuf, ref_str, s);
else
- printf("%.7s %s\n", id_str, s);
+ printf("%s%.7s %s\n", datebuf, id_str, s);
if (fflush(stdout) != 0 && err == NULL)
err = got_error_from_errno("fflush");