aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-09-25 09:39:24 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-09-25 09:39:24 -0700
commit1ad6d46235d135582d5cbb91ec0186b485c7b5c1 (patch)
treee4a98d08b88862305d9f13ccef82180de33e8bcc /connect.c
parent6ef1daf77202aee71056771d91dd12121c6061fd (diff)
parentd79796bcf05b89774671a75b3285000c43129823 (diff)
downloadgit-1ad6d46235d135582d5cbb91ec0186b485c7b5c1.tar.gz
git-1ad6d46235d135582d5cbb91ec0186b485c7b5c1.tar.xz
Merge branch 'jc/alternate-push'
* jc/alternate-push: push: receiver end advertises refs from alternate repositories push: prepare sender to receive extended ref information from the receiver receive-pack: make it a builtin is_directory(): a generic helper function
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index dd96f8e04..67d2cd86a 100644
--- a/connect.c
+++ b/connect.c
@@ -41,12 +41,20 @@ 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++;
+}
+
/*
* Read all the refs from the other end
*/
struct ref **get_remote_heads(int in, struct ref **list,
int nr_match, char **match,
- unsigned int flags)
+ unsigned int flags,
+ struct extra_have_objects *extra_have)
{
*list = NULL;
for (;;) {
@@ -72,6 +80,12 @@ struct ref **get_remote_heads(int in, struct ref **list,
server_capabilities = xstrdup(name + name_len + 1);
}
+ if (extra_have &&
+ name_len == 5 && !memcmp(".have", name, 5)) {
+ add_extra_have(extra_have, old_sha1);
+ continue;
+ }
+
if (!check_ref(name, name_len, flags))
continue;
if (nr_match && !path_match(name, nr_match, match))