aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 20:02:29 +0700
committerJunio C Hamano <gitster@pobox.com>2013-12-10 16:14:15 -0800
commit13eb4626c43b3116bb431671d593565eadc36852 (patch)
tree01f7f161d5eedaaf3498eef791cbefbcf6234f68 /connect.c
parent75f8cbab2a2ddc50728ade82baad223ed54bb040 (diff)
downloadgit-13eb4626c43b3116bb431671d593565eadc36852.tar.gz
git-13eb4626c43b3116bb431671d593565eadc36852.tar.xz
remote.h: replace struct extra_have_objects with struct sha1_array
The latter can do everything the former can and is used in many more places. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/connect.c b/connect.c
index 06e88b070..48eec414f 100644
--- a/connect.c
+++ b/connect.c
@@ -8,6 +8,7 @@
#include "connect.h"
#include "url.h"
#include "string-list.h"
+#include "sha1-array.h"
static char *server_capabilities;
static const char *parse_feature_value(const char *, const char *, int *);
@@ -45,13 +46,6 @@ int check_ref_type(const struct ref *ref, int flags)
return check_ref(ref->name, strlen(ref->name), flags);
}
-static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1)
-{
- ALLOC_GROW(extra->array, extra->nr + 1, extra->alloc);
- hashcpy(&(extra->array[extra->nr][0]), sha1);
- extra->nr++;
-}
-
static void die_initial_contact(int got_at_least_one_head)
{
if (got_at_least_one_head)
@@ -122,7 +116,7 @@ static void annotate_refs_with_symref_info(struct ref *ref)
*/
struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
struct ref **list, unsigned int flags,
- struct extra_have_objects *extra_have)
+ struct sha1_array *extra_have)
{
struct ref **orig_list = list;
int got_at_least_one_head = 0;
@@ -160,7 +154,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
if (extra_have &&
name_len == 5 && !memcmp(".have", name, 5)) {
- add_extra_have(extra_have, old_sha1);
+ sha1_array_append(extra_have, old_sha1);
continue;
}