Merge branch 'jk/fetch-no-tail-match-refs' into maint
* jk/fetch-no-tail-match-refs: connect.c: drop path_match function fetch-pack: match refs exactly t5500: give fully-qualified refs to fetch-pack drop "match" parameter from get_remote_heads
This commit is contained in:
24
connect.c
24
connect.c
@ -53,7 +53,6 @@ static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1
|
||||
* 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,
|
||||
struct extra_have_objects *extra_have)
|
||||
{
|
||||
@ -92,8 +91,6 @@ struct ref **get_remote_heads(int in, struct ref **list,
|
||||
|
||||
if (!check_ref(name, name_len, flags))
|
||||
continue;
|
||||
if (nr_match && !path_match(name, nr_match, match))
|
||||
continue;
|
||||
ref = alloc_ref(buffer + 41);
|
||||
hashcpy(ref->old_sha1, old_sha1);
|
||||
*list = ref;
|
||||
@ -108,27 +105,6 @@ int server_supports(const char *feature)
|
||||
strstr(server_capabilities, feature) != NULL;
|
||||
}
|
||||
|
||||
int path_match(const char *path, int nr, char **match)
|
||||
{
|
||||
int i;
|
||||
int pathlen = strlen(path);
|
||||
|
||||
for (i = 0; i < nr; i++) {
|
||||
char *s = match[i];
|
||||
int len = strlen(s);
|
||||
|
||||
if (!len || len > pathlen)
|
||||
continue;
|
||||
if (memcmp(path + pathlen - len, s, len))
|
||||
continue;
|
||||
if (pathlen > len && path[pathlen - len - 1] != '/')
|
||||
continue;
|
||||
*s = 0;
|
||||
return (i + 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum protocol {
|
||||
PROTO_LOCAL = 1,
|
||||
PROTO_SSH,
|
||||
|
Reference in New Issue
Block a user