aboutsummaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2007-10-29 21:05:40 -0400
committerJunio C Hamano <gitster@pobox.com>2007-11-02 22:40:43 -0700
commit4577370e9bfeca8652880b99b8499f76d18865ba (patch)
tree3df529fad99232d7f82f0389d0d8f5dc571319c8 /transport.c
parente3d6d56f1c2097f13a427e158638e5e0918e5705 (diff)
downloadgit-4577370e9bfeca8652880b99b8499f76d18865ba.tar.gz
git-4577370e9bfeca8652880b99b8499f76d18865ba.tar.xz
Miscellaneous const changes and utilities
The list of remote refs in struct transport should be const, because builtin-fetch will get confused if it changes. The url in git_connect should be const (and work on a copy) instead of requiring the caller to copy it. match_refs doesn't modify the refspecs it gets. get_fetch_map and get_remote_ref don't change the list they get. Allow transport get_refs_list methods to modify the struct transport. Add a function to copy a list of refs, when a function needs a mutable copy of a const list. Add a function to check the type of a ref, as per the code in connect.c Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/transport.c b/transport.c
index d44fe7cee..ab79f0cbb 100644
--- a/transport.c
+++ b/transport.c
@@ -141,7 +141,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
}
}
-static struct ref *get_refs_via_rsync(const struct transport *transport)
+static struct ref *get_refs_via_rsync(struct transport *transport)
{
struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
struct ref dummy, *tail = &dummy;
@@ -427,7 +427,7 @@ static int missing__target(int code, int result)
#define missing_target(a) missing__target((a)->http_code, (a)->curl_result)
-static struct ref *get_refs_via_curl(const struct transport *transport)
+static struct ref *get_refs_via_curl(struct transport *transport)
{
struct buffer buffer;
char *data, *start, *mid;
@@ -524,7 +524,7 @@ struct bundle_transport_data {
struct bundle_header header;
};
-static struct ref *get_refs_from_bundle(const struct transport *transport)
+static struct ref *get_refs_from_bundle(struct transport *transport)
{
struct bundle_transport_data *data = transport->data;
struct ref *result = NULL;
@@ -596,7 +596,7 @@ static int set_git_option(struct transport *connection,
return 1;
}
-static struct ref *get_refs_via_connect(const struct transport *transport)
+static struct ref *get_refs_via_connect(struct transport *transport)
{
struct git_transport_data *data = transport->data;
struct ref *refs;
@@ -781,7 +781,7 @@ int transport_push(struct transport *transport,
return transport->push(transport, refspec_nr, refspec, flags);
}
-struct ref *transport_get_remote_refs(struct transport *transport)
+const struct ref *transport_get_remote_refs(struct transport *transport)
{
if (!transport->remote_refs)
transport->remote_refs = transport->get_refs_list(transport);