{"thread":{"id":"13160","subject":"[PATCH 1/8] Mark the list of refs to fetch as const","startedAt":"2008-04-17T23:32:22Z","lastAt":"2008-04-17T23:32:22Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"74692","messageId":"alpine.LNX.1.00.0804171931280.19665@iabervon.org","threadId":"13160","inReplyTo":null,"subject":"[PATCH 1/8] Mark the list of refs to fetch as const","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-04-17T23:32:22Z","receivedAt":"2008-04-17T23:32:22Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"Fetching the objects doesn't actually modify the list in any of the\ncode paths, so this will allow code that fetches the entire (const)\nlist of available refs to just pass the list in directly.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n transport.c |   16 ++++++++--------\n transport.h |    4 ++--\n 2 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 393e0e8..a3b8052 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -203,7 +203,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport)\n }\n \n static int fetch_objs_via_rsync(struct transport *transport,\n-\t\t\t\t int nr_objs, struct ref **to_fetch)\n+\t\t\t\tint nr_objs, const struct ref **to_fetch)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \tstruct child_process rsync;\n@@ -350,7 +350,7 @@ static int rsync_transport_push(struct transport *transport,\n \n #ifndef NO_CURL /* http fetch is the only user */\n static int fetch_objs_via_walker(struct transport *transport,\n-\t\t\t\t int nr_objs, struct ref **to_fetch)\n+\t\t\t\t int nr_objs, const struct ref **to_fetch)\n {\n \tchar *dest = xstrdup(transport->url);\n \tstruct walker *walker = transport->data;\n@@ -504,7 +504,7 @@ static struct ref *get_refs_via_curl(struct transport *transport)\n }\n \n static int fetch_objs_via_curl(struct transport *transport,\n-\t\t\t\t int nr_objs, struct ref **to_fetch)\n+\t\t\t\t int nr_objs, const struct ref **to_fetch)\n {\n \tif (!transport->data)\n \t\ttransport->data = get_http_walker(transport->url,\n@@ -542,7 +542,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport)\n }\n \n static int fetch_refs_from_bundle(struct transport *transport,\n-\t\t\t       int nr_heads, struct ref **to_fetch)\n+\t\t\t       int nr_heads, const struct ref **to_fetch)\n {\n \tstruct bundle_transport_data *data = transport->data;\n \treturn unbundle(&data->header, data->fd);\n@@ -616,7 +616,7 @@ static struct ref *get_refs_via_connect(struct transport *transport)\n }\n \n static int fetch_refs_via_pack(struct transport *transport,\n-\t\t\t       int nr_heads, struct ref **to_fetch)\n+\t\t\t       int nr_heads, const struct ref **to_fetch)\n {\n \tstruct git_transport_data *data = transport->data;\n \tchar **heads = xmalloc(nr_heads * sizeof(*heads));\n@@ -784,12 +784,12 @@ const struct ref *transport_get_remote_refs(struct transport *transport)\n \treturn transport->remote_refs;\n }\n \n-int transport_fetch_refs(struct transport *transport, struct ref *refs)\n+int transport_fetch_refs(struct transport *transport, const struct ref *refs)\n {\n \tint rc;\n \tint nr_heads = 0, nr_alloc = 0;\n-\tstruct ref **heads = NULL;\n-\tstruct ref *rm;\n+\tconst struct ref **heads = NULL;\n+\tconst struct ref *rm;\n \n \tfor (rm = refs; rm; rm = rm->next) {\n \t\tif (rm->peer_ref &&\ndiff --git a/transport.h b/transport.h\nindex 8abfc0a..d0b5205 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -19,7 +19,7 @@ struct transport {\n \t\t\t  const char *value);\n \n \tstruct ref *(*get_refs_list)(struct transport *transport);\n-\tint (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);\n+\tint (*fetch)(struct transport *transport, int refs_nr, const struct ref **refs);\n \tint (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags);\n \n \tint (*disconnect)(struct transport *connection);\n@@ -68,7 +68,7 @@ int transport_push(struct transport *connection,\n \n const struct ref *transport_get_remote_refs(struct transport *transport);\n \n-int transport_fetch_refs(struct transport *transport, struct ref *refs);\n+int transport_fetch_refs(struct transport *transport, const struct ref *refs);\n void transport_unlock_pack(struct transport *transport);\n int transport_disconnect(struct transport *transport);\n \n-- \n1.5.4.3.610.gea6cd\n"}]}