commit - 7841c0d12f0a0e3f73db772df3b177a99ac0771f
commit + 472dfe052943732fea89236959063c8ccdb769aa
blob - 2817ac884ce25ec43a9812d10cca3e9dc017a4cf
blob + 1b4b7bc8fc2baddfd1f3353725f35bd6ac9af0cf
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
/* Structure for GOT_IMSG_COMMIT data. */
struct got_imsg_commit_object {
- uint8_t tree_id[SHA1_DIGEST_LENGTH];
+ struct got_object_id tree_id;
size_t author_len;
time_t author_time;
time_t author_gmtoff;
* Followed by author_len + committer_len data bytes
*/
- /* Followed by 'nparents' SHA1_DIGEST_LENGTH length strings */
+ /* Followed by 'nparents' struct got_object_id */
/*
* Followed by 'logmsg_len' bytes of commit log message data in
blob - 1f118154617c4dae7a5a12d5531b577d6d906da7
blob + d40d65ea1e93b234a672d9edd3fef1c550898939
--- lib/privsep.c
+++ lib/privsep.c
size_t logmsg_len = strlen(commit->logmsg);
total = sizeof(*icommit) + author_len + committer_len +
- commit->nparents * SHA1_DIGEST_LENGTH;
+ commit->nparents * sizeof(struct got_object_id);
buf = malloc(total);
if (buf == NULL)
return got_error_from_errno("malloc");
icommit = (struct got_imsg_commit_object *)buf;
- memcpy(icommit->tree_id, commit->tree_id->sha1,
- sizeof(icommit->tree_id));
+ memcpy(&icommit->tree_id, commit->tree_id, sizeof(icommit->tree_id));
icommit->author_len = author_len;
icommit->author_time = commit->author_time;
icommit->author_gmtoff = commit->author_gmtoff;
memcpy(buf + len, commit->committer, committer_len);
len += committer_len;
STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
- memcpy(buf + len, &qid->id, SHA1_DIGEST_LENGTH);
- len += SHA1_DIGEST_LENGTH;
+ memcpy(buf + len, &qid->id, sizeof(qid->id));
+ len += sizeof(qid->id);
}
if (imsg_compose(ibuf, GOT_IMSG_COMMIT, 0, 0, -1, buf, len) == -1) {
icommit = imsg->data;
if (datalen != sizeof(*icommit) + icommit->author_len +
icommit->committer_len +
- icommit->nparents * SHA1_DIGEST_LENGTH)
+ icommit->nparents * sizeof(struct got_object_id))
return got_error(GOT_ERR_PRIVSEP_LEN);
if (icommit->nparents < 0)
return got_error_from_errno(
"got_object_commit_alloc_partial");
- memcpy((*commit)->tree_id->sha1, icommit->tree_id,
- SHA1_DIGEST_LENGTH);
+ memcpy((*commit)->tree_id, &icommit->tree_id,
+ sizeof(icommit->tree_id));
(*commit)->author_time = icommit->author_time;
(*commit)->author_gmtoff = icommit->author_gmtoff;
(*commit)->committer_time = icommit->committer_time;
if (err)
break;
memcpy(&qid->id, imsg->data + len +
- i * SHA1_DIGEST_LENGTH, sizeof(qid->id));
+ i * sizeof(qid->id), sizeof(qid->id));
STAILQ_INSERT_TAIL(&(*commit)->parent_ids, qid, entry);
(*commit)->nparents++;
}