summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-14 01:57:40 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-15 18:23:40 (GMT)
commit1a7141ff28e217312da4b289127875905c6ec479 (patch)
treea8e87b3b44fb81f492d6e073008dbb4a85a3f2e6 /connect.c
parentd8a1deecc6ef37728b951eaba051deb7e0a38af8 (diff)
downloadgit-1a7141ff28e217312da4b289127875905c6ec479.zip
git-1a7141ff28e217312da4b289127875905c6ec479.tar.gz
git-1a7141ff28e217312da4b289127875905c6ec479.tar.bz2
Ignore funny refname sent from remote
This allows the remote side (most notably, upload-pack) to show additional information without affecting the downloader. Peek-remote does not ignore them -- this is to make it useful for Pasky's automatic tag following. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 247f02f..f71eba8 100644
--- a/connect.c
+++ b/connect.c
@@ -10,7 +10,8 @@
/*
* Read all the refs from the other end
*/
-struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match)
+struct ref **get_remote_heads(int in, struct ref **list,
+ int nr_match, char **match, int ignore_funny)
{
*list = NULL;
for (;;) {
@@ -29,6 +30,11 @@ struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **ma
if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ')
die("protocol error: expected sha/ref, got '%s'", buffer);
name = buffer + 41;
+
+ if (ignore_funny && 45 < len && !memcmp(name, "refs/", 5) &&
+ check_ref_format(name + 5))
+ continue;
+
if (nr_match && !path_match(name, nr_match, match))
continue;
ref = xcalloc(1, sizeof(*ref) + len - 40);