projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-upload-pack: More efficient usage of the has_sha1 array
[git.git]
/
connect.c
diff --git
a/connect.c
b/connect.c
index
0e6f27e
..
b171c5d
100644
(file)
--- a/
connect.c
+++ b/
connect.c
@@
-1,6
+1,7
@@
#include "cache.h"
#include "pkt-line.h"
#include "quote.h"
#include "cache.h"
#include "pkt-line.h"
#include "quote.h"
+#include "refs.h"
#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@
-10,7
+11,8
@@
/*
* Read all the refs from the other end
*/
/*
* 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 (;;) {
{
*list = NULL;
for (;;) {
@@
-29,6
+31,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 (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);
if (nr_match && !path_match(name, nr_match, match))
continue;
ref = xcalloc(1, sizeof(*ref) + len - 40);
@@
-284,13
+291,17
@@
static enum protocol get_protocol(const char *name)
return PROTO_SSH;
if (!strcmp(name, "git"))
return PROTO_GIT;
return PROTO_SSH;
if (!strcmp(name, "git"))
return PROTO_GIT;
+ if (!strcmp(name, "git+ssh"))
+ return PROTO_SSH;
+ if (!strcmp(name, "ssh+git"))
+ return PROTO_SSH;
die("I don't handle protocol '%s'", name);
}
#define STR_(s) # s
#define STR(s) STR_(s)
die("I don't handle protocol '%s'", name);
}
#define STR_(s) # s
#define STR(s) STR_(s)
-#ifndef
__CYGWIN__
+#ifndef
NO_IPV6
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
{
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
{
@@
-348,7
+359,7
@@
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
return 0;
}
return 0;
}
-#else /*
__CYGWIN__
*/
+#else /*
NO_IPV6
*/
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
{
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
{
@@
-397,7
+408,7
@@
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
memset(&sa, 0, sizeof sa);
sa.sin_family = he->h_addrtype;
memset(&sa, 0, sizeof sa);
sa.sin_family = he->h_addrtype;
- sa.sin_port =
nport
;
+ sa.sin_port =
htons(nport)
;
memcpy(&sa.sin_addr, ap, he->h_length);
if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
memcpy(&sa.sin_addr, ap, he->h_length);
if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
@@
-417,7
+428,7
@@
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
return 0;
}
return 0;
}
-#endif /*
__CYGWIN__
*/
+#endif /*
NO_IPV6
*/
/*
* Yeah, yeah, fixme. Need to pass in the heads etc.
/*
* Yeah, yeah, fixme. Need to pass in the heads etc.