diff --git a/builtin/odb--daemon.c b/builtin/odb--daemon.c index feadffb36772f7..4f11dd136d09ae 100644 --- a/builtin/odb--daemon.c +++ b/builtin/odb--daemon.c @@ -255,13 +255,13 @@ static int odb_ipc_cb__get_parent(struct my_odb_ipc_state *state, return 0; } -static int odb_ipc_cb__get_nth_ancestor(struct my_odb_ipc_state *state, - const char *command, size_t command_len, - ipc_server_reply_cb *reply_cb, - struct ipc_server_reply_data *reply_data) +static int odb_ipc_cb__get_ancestor(struct my_odb_ipc_state *state, + const char *command, size_t command_len, + ipc_server_reply_cb *reply_cb, + struct ipc_server_reply_data *reply_data) { - struct odb_over_ipc__get_nth_ancestor__request *req; - struct odb_over_ipc__get_nth_ancestor__response *resp; + struct odb_over_ipc__get_ancestor__request *req; + struct odb_over_ipc__get_ancestor__response *resp; const char *name; size_t name_len; int ret; @@ -269,7 +269,7 @@ static int odb_ipc_cb__get_nth_ancestor(struct my_odb_ipc_state *state, if (command_len < sizeof(*req)) BUG("incorrect size for binary data"); - req = (struct odb_over_ipc__get_nth_ancestor__request *)command; + req = (struct odb_over_ipc__get_ancestor__request *)command; name = command + sizeof(*req); name_len = command_len - sizeof(*req); @@ -278,7 +278,7 @@ static int odb_ipc_cb__get_nth_ancestor(struct my_odb_ipc_state *state, BUG("incorrect data length"); resp = xmalloc(sizeof(*resp)); - memcpy(&resp->key.key, "get-nth-ancestor", 11); + memcpy(&resp->key.key, "get-ancestor", 11); ret = get_nth_ancestor(the_repository, name, name_len, &resp->oid, req->generation); @@ -377,14 +377,14 @@ static int odb_ipc_cb(void *data, return 0; } - if (!strcmp(command, "get-nth-ancestor")) { + if (!strcmp(command, "get-ancestor")) { /* * A client has requested that we find the nth ancestpr of a * given object. */ trace2_region_enter("odb-daemon", "get-nth-ancestor", NULL); - ret = odb_ipc_cb__get_nth_ancestor(state, command, command_len, - reply_cb, reply_data); + ret = odb_ipc_cb__get_ancestor(state, command, command_len, + reply_cb, reply_data); trace2_region_leave("odb-daemon", "get-nth-ancestor", NULL); return 0; } diff --git a/object-name.c b/object-name.c index 9cd45b0163675e..5441c9b53b671b 100644 --- a/object-name.c +++ b/object-name.c @@ -1125,7 +1125,7 @@ enum get_oid_result get_nth_ancestor(struct repository *r, struct commit *commit; int ret; - if (odb_over_ipc__get_nth_ancestor(r, name, len, generation, result) == 0) + if (odb_over_ipc__get_ancestor(r, name, len, generation, result) == 0) return FOUND; ret = get_oid_1(r, name, len, &oid, GET_OID_COMMITTISH); diff --git a/odb-over-ipc.c b/odb-over-ipc.c index cbab474740e22c..f0342df1990659 100644 --- a/odb-over-ipc.c +++ b/odb-over-ipc.c @@ -311,12 +311,12 @@ int odb_over_ipc__get_parent(struct repository *r, const char *name, int len, return ret; } -int odb_over_ipc__get_nth_ancestor(struct repository *r, const char *name, - int len, int generation, - struct object_id *result) +int odb_over_ipc__get_ancestor(struct repository *r, const char *name, + int len, int generation, + struct object_id *result) { - struct odb_over_ipc__get_nth_ancestor__request req; - struct odb_over_ipc__get_nth_ancestor__response *resp; + struct odb_over_ipc__get_ancestor__request req; + struct odb_over_ipc__get_ancestor__response *resp; struct strbuf msg = STRBUF_INIT; struct strbuf answer = STRBUF_INIT; int ret; @@ -331,7 +331,7 @@ int odb_over_ipc__get_nth_ancestor(struct repository *r, const char *name, return -1; memset(&req, 0, sizeof(req)); - memcpy(req.key.key, "get-nth-ancestor", 16); + memcpy(req.key.key, "get-ancestor", 12); req.generation = generation; req.name_len = len; @@ -351,7 +351,7 @@ int odb_over_ipc__get_nth_ancestor(struct repository *r, const char *name, if (answer.len != sizeof(*resp)) BUG("incorrect size for binary data"); - resp = (struct odb_over_ipc__get_nth_ancestor__response *)answer.buf; + resp = (struct odb_over_ipc__get_ancestor__response *)answer.buf; oidcpy(result, &resp->oid); diff --git a/odb-over-ipc.h b/odb-over-ipc.h index 26a5111c197181..e84a2ce7b0491e 100644 --- a/odb-over-ipc.h +++ b/odb-over-ipc.h @@ -95,14 +95,14 @@ struct odb_over_ipc__get_parent__response struct object_id oid; }; -struct odb_over_ipc__get_nth_ancestor__request +struct odb_over_ipc__get_ancestor__request { struct odb_over_ipc__key key; int generation; int name_len; }; -struct odb_over_ipc__get_nth_ancestor__response +struct odb_over_ipc__get_ancestor__response { struct odb_over_ipc__key key; struct object_id oid; @@ -129,9 +129,9 @@ int odb_over_ipc__hash_object(struct repository *r, struct object_id *oid, int odb_over_ipc__get_parent(struct repository *r, const char *name, int len, int idx, struct object_id *result); -int odb_over_ipc__get_nth_ancestor(struct repository *r, const char *name, - int len, int generation, - struct object_id *result); +int odb_over_ipc__get_ancestor(struct repository *r, const char *name, + int len, int generation, + struct object_id *result); /* * Explicitly shutdown IPC connection to the `git odb--daemon` process.