X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=remote.c;h=ca42a126ad04514f0ed8378768ebce98cfc5a659;hb=1c2ef66f63e60539044d1e0cd8fbfbccd2cefc2e;hp=26ce56046dd14fec4ae59c7e7df3c2072178c51d;hpb=206af7c96b134b4962fa04fa174a25f29efd7e5e;p=git.git diff --git a/remote.c b/remote.c index 26ce56046..ca42a126a 100644 --- a/remote.c +++ b/remote.c @@ -443,6 +443,8 @@ static int handle_config(const char *key, const char *value, void *cb) } else if (!strcmp(subkey, ".tagopt")) { if (!strcmp(value, "--no-tags")) remote->fetch_tags = -1; + else if (!strcmp(value, "--tags")) + remote->fetch_tags = 2; } else if (!strcmp(subkey, ".proxy")) { return git_config_string((const char **)&remote->http_proxy, key, value); @@ -491,7 +493,7 @@ static void read_config(void) } /* - * We need to make sure the tracking branches are well formed, but a + * We need to make sure the remote-tracking branches are well formed, but a * wildcard refspec in "struct refspec" must have a trailing slash. We * temporarily drop the trailing '/' while calling check_ref_format(), * and put it back. The caller knows that a CHECK_REF_FORMAT_ONELEVEL @@ -657,10 +659,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp int valid_fetch_refspec(const char *fetch_refspec_str) { - const char *fetch_refspec[] = { fetch_refspec_str }; struct refspec *refspec; - refspec = parse_refspec_internal(1, fetch_refspec, 1, 1); + refspec = parse_refspec_internal(1, &fetch_refspec_str, 1, 1); free_refspecs(refspec, 1); return !!refspec; } @@ -753,7 +754,7 @@ int for_each_remote(each_remote_fn fn, void *priv) void ref_remove_duplicates(struct ref *ref_map) { - struct string_list refs = { NULL, 0, 0, 0 }; + struct string_list refs = STRING_LIST_INIT_NODUP; struct string_list_item *item = NULL; struct ref *prev = NULL, *next = NULL; for (; ref_map; prev = ref_map, ref_map = next) { @@ -761,7 +762,7 @@ void ref_remove_duplicates(struct ref *ref_map) if (!ref_map->peer_ref) continue; - item = string_list_lookup(ref_map->peer_ref->name, &refs); + item = string_list_lookup(&refs, ref_map->peer_ref->name); if (item) { if (strcmp(((struct ref *)item->util)->name, ref_map->name)) @@ -776,7 +777,7 @@ void ref_remove_duplicates(struct ref *ref_map) continue; } - item = string_list_insert(ref_map->peer_ref->name, &refs); + item = string_list_insert(&refs, ref_map->peer_ref->name); item->util = ref_map; } string_list_clear(&refs, 0); @@ -1703,13 +1704,13 @@ static int get_stale_heads_cb(const char *refname, struct ref *get_stale_heads(struct remote *remote, struct ref *fetch_map) { struct ref *ref, *stale_refs = NULL; - struct string_list ref_names = { NULL, 0, 0, 0 }; + struct string_list ref_names = STRING_LIST_INIT_NODUP; struct stale_heads_info info; info.remote = remote; info.ref_names = &ref_names; info.stale_refs_tail = &stale_refs; for (ref = fetch_map; ref; ref = ref->next) - string_list_append(ref->name, &ref_names); + string_list_append(&ref_names, ref->name); sort_string_list(&ref_names); for_each_ref(get_stale_heads_cb, &info); string_list_clear(&ref_names, 0);