summaryrefslogtreecommitdiff
path: root/builtin-fetch.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 /builtin-fetch.c
parente3d6d56f1c2097f13a427e158638e5e0918e5705 (diff)
downloadgit-4577370e9bfeca8652880b99b8499f76d18865ba.tar.gz
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 'builtin-fetch.c')
-rw-r--r--builtin-fetch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 003ed76d16..fa0af170dd 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -29,7 +29,7 @@ static void unlock_pack_on_signal(int signo)
}
static void add_merge_config(struct ref **head,
- struct ref *remote_refs,
+ const struct ref *remote_refs,
struct branch *branch,
struct ref ***tail)
{
@@ -77,7 +77,7 @@ static struct ref *get_ref_map(struct transport *transport,
struct ref *ref_map = NULL;
struct ref **tail = &ref_map;
- struct ref *remote_refs = transport_get_remote_refs(transport);
+ const struct ref *remote_refs = transport_get_remote_refs(transport);
if (ref_count || tags) {
for (i = 0; i < ref_count; i++) {
@@ -345,12 +345,12 @@ static struct ref *find_non_local_tags(struct transport *transport,
struct path_list new_refs = { NULL, 0, 0, 1 };
char *ref_name;
int ref_name_len;
- unsigned char *ref_sha1;
- struct ref *tag_ref;
+ const unsigned char *ref_sha1;
+ const struct ref *tag_ref;
struct ref *rm = NULL;
struct ref *ref_map = NULL;
struct ref **tail = &ref_map;
- struct ref *ref;
+ const struct ref *ref;
for_each_ref(add_existing, &existing_refs);
for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {