Skip to content

Commit 0f804b0

Browse files
peffgitster
authored andcommitted
fetch_pack(): drop unused parameters
We don't need the caller of fetch_pack() to pass in "dest", which is the remote URL. Since ba22785 (Reduce the number of connects when fetching, 2008-02-04), the caller is responsible for calling git_connect() itself, and our "dest" parameter is unused. That commit also started passing us the resulting "conn" child_process from git_connect(). But likewise, we do not need do anything with it. The descriptors in "fd" are enough for us, and the caller is responsible for cleaning up "conn". We can just drop both parameters. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c5c3350 commit 0f804b0

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

builtin/fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
234234
BUG("unknown protocol version");
235235
}
236236

237-
ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought,
237+
ref = fetch_pack(&args, fd, ref, sought, nr_sought,
238238
&shallow, pack_lockfile_ptr, version);
239239
if (pack_lockfile) {
240240
printf("lock %s\n", pack_lockfile);

fetch-pack.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,9 +1615,8 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
16151615
}
16161616

16171617
struct ref *fetch_pack(struct fetch_pack_args *args,
1618-
int fd[], struct child_process *conn,
1618+
int fd[],
16191619
const struct ref *ref,
1620-
const char *dest,
16211620
struct ref **sought, int nr_sought,
16221621
struct oid_array *shallow,
16231622
char **pack_lockfile,

fetch-pack.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ struct fetch_pack_args {
7878
* marked as such.
7979
*/
8080
struct ref *fetch_pack(struct fetch_pack_args *args,
81-
int fd[], struct child_process *conn,
81+
int fd[],
8282
const struct ref *ref,
83-
const char *dest,
8483
struct ref **sought,
8584
int nr_sought,
8685
struct oid_array *shallow,

transport.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ static int fetch_refs_via_pack(struct transport *transport,
314314
int ret = 0;
315315
struct git_transport_data *data = transport->data;
316316
struct ref *refs = NULL;
317-
char *dest = xstrdup(transport->url);
318317
struct fetch_pack_args args;
319318
struct ref *refs_tmp = NULL;
320319

@@ -356,16 +355,16 @@ static int fetch_refs_via_pack(struct transport *transport,
356355

357356
switch (data->version) {
358357
case protocol_v2:
359-
refs = fetch_pack(&args, data->fd, data->conn,
358+
refs = fetch_pack(&args, data->fd,
360359
refs_tmp ? refs_tmp : transport->remote_refs,
361-
dest, to_fetch, nr_heads, &data->shallow,
360+
to_fetch, nr_heads, &data->shallow,
362361
&transport->pack_lockfile, data->version);
363362
break;
364363
case protocol_v1:
365364
case protocol_v0:
366-
refs = fetch_pack(&args, data->fd, data->conn,
365+
refs = fetch_pack(&args, data->fd,
367366
refs_tmp ? refs_tmp : transport->remote_refs,
368-
dest, to_fetch, nr_heads, &data->shallow,
367+
to_fetch, nr_heads, &data->shallow,
369368
&transport->pack_lockfile, data->version);
370369
break;
371370
case protocol_unknown_version:
@@ -389,7 +388,6 @@ static int fetch_refs_via_pack(struct transport *transport,
389388

390389
free_refs(refs_tmp);
391390
free_refs(refs);
392-
free(dest);
393391
return ret;
394392
}
395393

0 commit comments

Comments
 (0)