Skip to content

Commit afe7c5f

Browse files
peffgitster
authored andcommitted
drop "match" parameter from get_remote_heads
The get_remote_heads function reads the list of remote refs during git protocol session. It dates all the way back to def88e9 (Commit first cut at "git-fetch-pack", 2005-07-04). At that time, the idea was to come up with a list of refs we were interested in, and then filter the list as we got it from the remote side. Later, 1baaae5 (Make maximal use of the remote refs, 2005-10-28) stopped filtering at the get_remote_heads layer, letting us use the non-matching refs to find common history. As a result, all callers now simply pass an empty match list (and any future callers will want to do the same). So let's drop these now-useless parameters. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 10dd3b2 commit afe7c5f

File tree

6 files changed

+7
-12
lines changed

6 files changed

+7
-12
lines changed

builtin/fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
976976
args.verbose ? CONNECT_VERBOSE : 0);
977977
}
978978

979-
get_remote_heads(fd[0], &ref, 0, NULL, 0, NULL);
979+
get_remote_heads(fd[0], &ref, 0, NULL);
980980

981981
ref = fetch_pack(&args, fd, conn, ref, dest,
982982
nr_heads, heads, pack_lockfile_ptr);

builtin/send-pack.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
494494

495495
memset(&extra_have, 0, sizeof(extra_have));
496496

497-
get_remote_heads(fd[0], &remote_refs, 0, NULL, REF_NORMAL,
498-
&extra_have);
497+
get_remote_heads(fd[0], &remote_refs, REF_NORMAL, &extra_have);
499498

500499
transport_verify_remote_names(nr_refspecs, refspecs);
501500

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ struct extra_have_objects {
10331033
int nr, alloc;
10341034
unsigned char (*array)[20];
10351035
};
1036-
extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, unsigned int flags, struct extra_have_objects *);
1036+
extern struct ref **get_remote_heads(int in, struct ref **list, unsigned int flags, struct extra_have_objects *);
10371037
extern int server_supports(const char *feature);
10381038

10391039
extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);

connect.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1
5353
* Read all the refs from the other end
5454
*/
5555
struct ref **get_remote_heads(int in, struct ref **list,
56-
int nr_match, char **match,
5756
unsigned int flags,
5857
struct extra_have_objects *extra_have)
5958
{
@@ -92,8 +91,6 @@ struct ref **get_remote_heads(int in, struct ref **list,
9291

9392
if (!check_ref(name, name_len, flags))
9493
continue;
95-
if (nr_match && !path_match(name, nr_match, match))
96-
continue;
9794
ref = alloc_ref(buffer + 41);
9895
hashcpy(ref->old_sha1, old_sha1);
9996
*list = ref;

remote-curl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static struct ref *parse_git_refs(struct discovery *heads)
200200

201201
if (start_async(&async))
202202
die("cannot start thread to parse advertised refs");
203-
get_remote_heads(async.out, &list, 0, NULL, 0, NULL);
203+
get_remote_heads(async.out, &list, 0, NULL);
204204
close(async.out);
205205
if (finish_async(&async))
206206
die("ref parsing thread failed");

transport.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
502502
struct ref *refs;
503503

504504
connect_setup(transport, for_push, 0);
505-
get_remote_heads(data->fd[0], &refs, 0, NULL,
505+
get_remote_heads(data->fd[0], &refs,
506506
for_push ? REF_NORMAL : 0, &data->extra_have);
507507
data->got_remote_heads = 1;
508508

@@ -537,7 +537,7 @@ static int fetch_refs_via_pack(struct transport *transport,
537537

538538
if (!data->got_remote_heads) {
539539
connect_setup(transport, 0, 0);
540-
get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0, NULL);
540+
get_remote_heads(data->fd[0], &refs_tmp, 0, NULL);
541541
data->got_remote_heads = 1;
542542
}
543543

@@ -772,8 +772,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
772772
struct ref *tmp_refs;
773773
connect_setup(transport, 1, 0);
774774

775-
get_remote_heads(data->fd[0], &tmp_refs, 0, NULL, REF_NORMAL,
776-
NULL);
775+
get_remote_heads(data->fd[0], &tmp_refs, REF_NORMAL, NULL);
777776
data->got_remote_heads = 1;
778777
}
779778

0 commit comments

Comments
 (0)