commit 6e72e6a3bf1fd0e9a976114e25c7aad6b22587b0 from: Stefan Sperling date: Sun Dec 23 22:21:35 2018 UTC there's no point in embedding the object header in commits commit - 1785f84a3a2f8d9dd6b73551560405f87a2e2ebb commit + 6e72e6a3bf1fd0e9a976114e25c7aad6b22587b0 blob - c3257cfa278471697b8fe6e3e8a8cb6396d55453 blob + 14bd628bae7ca8d8048fca27f37f546c5aca6701 --- lib/got_lib_object.h +++ lib/got_lib_object.h @@ -37,7 +37,6 @@ struct got_object { }; struct got_commit_object { - struct got_object *obj; struct got_object_id *tree_id; unsigned int nparents; struct got_object_id_queue parent_ids; blob - 41e5235fe66dc73bcd2f261027677ff112f16817 blob + 0406a8a5ff30b2df72569dbf3eeddbc5c3ae1bd4 --- lib/object.c +++ lib/object.c @@ -1171,25 +1171,6 @@ done: } static const struct got_error * -receive_commit(struct got_commit_object **commit, struct imsgbuf *ibuf) -{ - const struct got_error *err = NULL; - struct got_object *obj; - - err = got_privsep_recv_obj(&obj, ibuf); - if (err) - return err; - - err = got_privsep_recv_commit(commit, ibuf); - if (err) - got_object_close(obj); - else - (*commit)->obj = obj; /* XXX should be embedded */ - - return err; -} - -static const struct got_error * request_commit(struct got_commit_object **commit, struct got_repository *repo, int fd) { @@ -1202,7 +1183,7 @@ request_commit(struct got_commit_object **commit, stru if (err) return err; - return receive_commit(commit, ibuf); + return got_privsep_recv_commit(commit, ibuf); } static const struct got_error * @@ -1216,7 +1197,7 @@ request_packed_commit(struct got_commit_object **commi if (err) return err; - return receive_commit(commit, pack->privsep_child->ibuf); + return got_privsep_recv_commit(commit, pack->privsep_child->ibuf); } const struct got_error * blob - b98b1784a35735c7c85b744968f43221f3a449a3 blob + f764c908531344ae49ac0ca7659a630fc305a14f --- lib/object_parse.c +++ lib/object_parse.c @@ -377,7 +377,6 @@ got_object_commit_close(struct got_commit_object *comm free(commit->author); free(commit->committer); free(commit->logmsg); - got_object_close(commit->obj); free(commit); } blob - eeafefcdae2da3791cde557835ec32b1b3c58c3b blob + c7431a4d45fb85ca0154f8278fad20793f975d66 --- libexec/got-read-commit/got-read-commit.c +++ libexec/got-read-commit/got-read-commit.c @@ -78,11 +78,7 @@ read_commit_object(struct got_commit_object **commit, err = got_object_parse_commit(commit, p + obj->hdrlen, len); done: free(p); - if (err) - got_object_close(obj); - else - (*commit)->obj = obj; /* XXX should be embedded in struct */ - + got_object_close(obj); return err; } @@ -146,13 +142,6 @@ main(int argc, char *argv[]) if (err) goto done; - /* XXX This flushes the pipe, should only fill it instead. */ - err = got_privsep_send_obj(&ibuf, commit->obj); - if (err) - goto done; - - /* XXX Assumes full imsg buf size, should take obj into - * account when above flush is removed. */ err = got_privsep_send_commit(&ibuf, commit); done: if (f) blob - 92227336ac9362deae0f19afe555b42461ad7b04 blob + 8d243d028bb093665b86aa4e60a01843e3032bb3 --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -148,19 +148,9 @@ commit_request(struct imsg *imsg, struct imsgbuf *ibuf free(buf); if (err) { got_object_close(obj); - return err; - } else - commit->obj = obj; /* XXX should be embedded */ - - /* XXX This flushes the pipe, should only fill it instead. */ - err = got_privsep_send_obj(ibuf, commit->obj); - if (err) { - got_object_commit_close(commit); return err; } - /* XXX Assumes full imsg buf size, should take obj into - * account when above flush is removed. */ err = got_privsep_send_commit(ibuf, commit); got_object_commit_close(commit); if (err) {