Mark the list of refs to fetch as const
Fetching the objects doesn't actually modify the list in any of the code paths, so this will allow code that fetches the entire (const) list of available refs to just pass the list in directly. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Barkalow committed
Apr 17, 2008 at 19:32 UTC
2d5c298f91b4b76a8b51b9b66283ef5a872736a0
2 files changed
+10
-10
transport.c
+8
-8
@@ -203,7 +203,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport)
203
}
204
205
static int fetch_objs_via_rsync(struct transport *transport,
206
- int nr_objs, struct ref **to_fetch)
206
+ int nr_objs, const struct ref **to_fetch)
207
{
208
struct strbuf buf = STRBUF_INIT;
209
struct child_process rsync;
@@ -350,7 +350,7 @@ static int rsync_transport_push(struct transport *transport,
350
351
#ifndef NO_CURL /* http fetch is the only user */
352
static int fetch_objs_via_walker(struct transport *transport,
353
- int nr_objs, struct ref **to_fetch)
353
+ int nr_objs, const struct ref **to_fetch)
354
{
355
char *dest = xstrdup(transport->url);
356
struct walker *walker = transport->data;
@@ -504,7 +504,7 @@ static struct ref *get_refs_via_curl(struct transport *transport)
504
}
505
506
static int fetch_objs_via_curl(struct transport *transport,
507
- int nr_objs, struct ref **to_fetch)
507
+ int nr_objs, const struct ref **to_fetch)
508
{
509
if (!transport->data)
510
transport->data = get_http_walker(transport->url,
@@ -542,7 +542,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport)
542
}
543
544
static int fetch_refs_from_bundle(struct transport *transport,
545
- int nr_heads, struct ref **to_fetch)
545
+ int nr_heads, const struct ref **to_fetch)
546
{
547
struct bundle_transport_data *data = transport->data;
548
return unbundle(&data->header, data->fd);
@@ -616,7 +616,7 @@ static struct ref *get_refs_via_connect(struct transport *transport)
616
}
617
618
static int fetch_refs_via_pack(struct transport *transport,
619
- int nr_heads, struct ref **to_fetch)
619
+ int nr_heads, const struct ref **to_fetch)
620
{
621
struct git_transport_data *data = transport->data;
622
char **heads = xmalloc(nr_heads * sizeof(*heads));
@@ -784,12 +784,12 @@ const struct ref *transport_get_remote_refs(struct transport *transport)
784
return transport->remote_refs;
785
}
786
787
-int transport_fetch_refs(struct transport *transport, struct ref *refs)
787
+int transport_fetch_refs(struct transport *transport, const struct ref *refs)
788
{
789
int rc;
790
int nr_heads = 0, nr_alloc = 0;
791
- struct ref **heads = NULL;
792
- struct ref *rm;
791
+ const struct ref **heads = NULL;
792
+ const struct ref *rm;
793
794
for (rm = refs; rm; rm = rm->next) {
795
if (rm->peer_ref &&
transport.h
+2
-2
@@ -19,7 +19,7 @@ struct transport {
19
const char *value);
20
21
struct ref *(*get_refs_list)(struct transport *transport);
22
- int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
22
+ int (*fetch)(struct transport *transport, int refs_nr, const struct ref **refs);
23
int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags);
24
25
int (*disconnect)(struct transport *connection);
@@ -68,7 +68,7 @@ int transport_push(struct transport *connection,
68
69
const struct ref *transport_get_remote_refs(struct transport *transport);
70
71
-int transport_fetch_refs(struct transport *transport, struct ref *refs);
71
+int transport_fetch_refs(struct transport *transport, const struct ref *refs);
72
void transport_unlock_pack(struct transport *transport);
73
int transport_disconnect(struct transport *transport);
74