there's no point in embedding the object header in commits
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
diff --git a/lib/got_lib_object.h b/lib/got_lib_object.h
index c3257cf..14bd628 100644
--- a/lib/got_lib_object.h
+++ b/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;
diff --git a/lib/object.c b/lib/object.c
index 41e5235..0406a8a 100644
--- a/lib/object.c
+++ b/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, struct got_repository *repo,
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 **commit, struct got_pack *pack,
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 *
diff --git a/lib/object_parse.c b/lib/object_parse.c
index b98b178..f764c90 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -377,7 +377,6 @@ got_object_commit_close(struct got_commit_object *commit)
free(commit->author);
free(commit->committer);
free(commit->logmsg);
- got_object_close(commit->obj);
free(commit);
}
diff --git a/libexec/got-read-commit/got-read-commit.c b/libexec/got-read-commit/got-read-commit.c
index eeafefc..c7431a4 100644
--- a/libexec/got-read-commit/got-read-commit.c
+++ b/libexec/got-read-commit/got-read-commit.c
@@ -78,11 +78,7 @@ read_commit_object(struct got_commit_object **commit, FILE *f)
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)
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index 9222733..8d243d0 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -149,18 +149,8 @@ commit_request(struct imsg *imsg, struct imsgbuf *ibuf, struct got_pack *pack,
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) {