make commit timestamps work across privsep
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/lib/got_lib_privsep.h b/lib/got_lib_privsep.h
index 3497719..f802293 100644
--- a/lib/got_lib_privsep.h
+++ b/lib/got_lib_privsep.h
@@ -99,7 +99,9 @@ struct got_imsg_object {
struct got_imsg_commit_object {
uint8_t tree_id[SHA1_DIGEST_LENGTH];
size_t author_len;
+ time_t author_time;
size_t committer_len;
+ time_t committer_time;
size_t logmsg_len;
int nparents;
diff --git a/lib/privsep.c b/lib/privsep.c
index b542a8d..c4ef656 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -266,7 +266,9 @@ got_privsep_send_commit(struct imsgbuf *ibuf, struct got_commit_object *commit)
memcpy(icommit.tree_id, commit->tree_id->sha1, sizeof(icommit.tree_id));
icommit.author_len = strlen(commit->author);
+ icommit.author_time = commit->author_time;
icommit.committer_len = strlen(commit->committer);
+ icommit.committer_time = commit->committer_time;
icommit.logmsg_len = strlen(commit->logmsg);
icommit.nparents = commit->nparents;
@@ -366,6 +368,7 @@ got_privsep_recv_commit(struct got_commit_object **commit, struct imsgbuf *ibuf)
err = got_error_from_errno();
break;
}
+ (*commit)->author_time = 0;
} else {
(*commit)->author = malloc(icommit.author_len + 1);
if ((*commit)->author == NULL) {
@@ -375,6 +378,7 @@ got_privsep_recv_commit(struct got_commit_object **commit, struct imsgbuf *ibuf)
memcpy((*commit)->author, data + len,
icommit.author_len);
(*commit)->author[icommit.author_len] = '\0';
+ (*commit)->author_time = icommit.author_time;
}
len += icommit.author_len;
@@ -384,6 +388,7 @@ got_privsep_recv_commit(struct got_commit_object **commit, struct imsgbuf *ibuf)
err = got_error_from_errno();
break;
}
+ (*commit)->committer_time = 0;
} else {
(*commit)->committer =
malloc(icommit.committer_len + 1);
@@ -394,6 +399,7 @@ got_privsep_recv_commit(struct got_commit_object **commit, struct imsgbuf *ibuf)
memcpy((*commit)->committer, data + len,
icommit.committer_len);
(*commit)->committer[icommit.committer_len] = '\0';
+ (*commit)->committer_time = icommit.committer_time;
}
len += icommit.committer_len;