Skip to content

Commit 9596a1c

Browse files
derrickstoleegitster
authored andcommitted
transport: rename negotiation_tips
The previous change added the --negotiation-restrict synonym for the --negotiation-tips option for 'git fetch'. In anticipation of adding a new option that behaves similarly but with distinct changes to its behavior, rename the internal representation of this data from 'negotiation_tips' to 'negotiation_restrict_tips'. The 'tips' part is kept because this is an oid_array in the transport layer. This requires the builtin to handle parsing refs into collections of oids so the transport layer can handle this cleaner form of the data. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d542ba8 commit 9596a1c

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

builtin/fetch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ static int add_oid(const struct reference *ref, void *cb_data)
15341534
return 0;
15351535
}
15361536

1537-
static void add_negotiation_tips(struct git_transport_options *smart_options)
1537+
static void add_negotiation_restrict_tips(struct git_transport_options *smart_options)
15381538
{
15391539
struct oid_array *oids = xcalloc(1, sizeof(*oids));
15401540
int i;
@@ -1561,7 +1561,7 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)
15611561
warning(_("ignoring %s=%s because it does not match any refs"),
15621562
"--negotiation-restrict", s);
15631563
}
1564-
smart_options->negotiation_tips = oids;
1564+
smart_options->negotiation_restrict_tips = oids;
15651565
}
15661566

15671567
static struct transport *prepare_transport(struct remote *remote, int deepen,
@@ -1597,7 +1597,7 @@ static struct transport *prepare_transport(struct remote *remote, int deepen,
15971597
}
15981598
if (negotiation_tip.nr) {
15991599
if (transport->smart_options)
1600-
add_negotiation_tips(transport->smart_options);
1600+
add_negotiation_restrict_tips(transport->smart_options);
16011601
else
16021602
warning(_("ignoring %s because the protocol does not support it"),
16031603
"--negotiation-restrict");

fetch-pack.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,21 +291,21 @@ static int next_flush(int stateless_rpc, int count)
291291
}
292292

293293
static void mark_tips(struct fetch_negotiator *negotiator,
294-
const struct oid_array *negotiation_tips)
294+
const struct oid_array *negotiation_restrict_tips)
295295
{
296296
struct refs_for_each_ref_options opts = {
297297
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
298298
};
299299
int i;
300300

301-
if (!negotiation_tips) {
301+
if (!negotiation_restrict_tips) {
302302
refs_for_each_ref_ext(get_main_ref_store(the_repository),
303303
rev_list_insert_ref_oid, negotiator, &opts);
304304
return;
305305
}
306306

307-
for (i = 0; i < negotiation_tips->nr; i++)
308-
rev_list_insert_ref(negotiator, &negotiation_tips->oid[i]);
307+
for (i = 0; i < negotiation_restrict_tips->nr; i++)
308+
rev_list_insert_ref(negotiator, &negotiation_restrict_tips->oid[i]);
309309
return;
310310
}
311311

@@ -355,7 +355,7 @@ static int find_common(struct fetch_negotiator *negotiator,
355355
PACKET_READ_CHOMP_NEWLINE |
356356
PACKET_READ_DIE_ON_ERR_PACKET);
357357

358-
mark_tips(negotiator, args->negotiation_tips);
358+
mark_tips(negotiator, args->negotiation_restrict_tips);
359359
for_each_cached_alternate(negotiator, insert_one_alternate_object);
360360

361361
fetching = 0;
@@ -1728,7 +1728,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
17281728
else
17291729
state = FETCH_SEND_REQUEST;
17301730

1731-
mark_tips(negotiator, args->negotiation_tips);
1731+
mark_tips(negotiator, args->negotiation_restrict_tips);
17321732
for_each_cached_alternate(negotiator,
17331733
insert_one_alternate_object);
17341734
break;
@@ -2177,7 +2177,7 @@ static void clear_common_flag(struct oidset *s)
21772177
}
21782178
}
21792179

2180-
void negotiate_using_fetch(const struct oid_array *negotiation_tips,
2180+
void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
21812181
const struct string_list *server_options,
21822182
int stateless_rpc,
21832183
int fd[],
@@ -2195,13 +2195,13 @@ void negotiate_using_fetch(const struct oid_array *negotiation_tips,
21952195
timestamp_t min_generation = GENERATION_NUMBER_INFINITY;
21962196

21972197
fetch_negotiator_init(the_repository, &negotiator);
2198-
mark_tips(&negotiator, negotiation_tips);
2198+
mark_tips(&negotiator, negotiation_restrict_tips);
21992199

22002200
packet_reader_init(&reader, fd[0], NULL, 0,
22012201
PACKET_READ_CHOMP_NEWLINE |
22022202
PACKET_READ_DIE_ON_ERR_PACKET);
22032203

2204-
oid_array_for_each((struct oid_array *) negotiation_tips,
2204+
oid_array_for_each((struct oid_array *) negotiation_restrict_tips,
22052205
add_to_object_array,
22062206
&nt_object_array);
22072207

fetch-pack.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct fetch_pack_args {
2121
* If not NULL, during packfile negotiation, fetch-pack will send "have"
2222
* lines only with these tips and their ancestors.
2323
*/
24-
const struct oid_array *negotiation_tips;
24+
const struct oid_array *negotiation_restrict_tips;
2525

2626
unsigned deepen_relative:1;
2727
unsigned quiet:1;
@@ -89,7 +89,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
8989
* In the capability advertisement that has happened prior to invoking this
9090
* function, the "wait-for-done" capability must be present.
9191
*/
92-
void negotiate_using_fetch(const struct oid_array *negotiation_tips,
92+
void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
9393
const struct string_list *server_options,
9494
int stateless_rpc,
9595
int fd[],

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ static int fetch_refs(struct transport *transport,
754754
set_helper_option(transport, "filter", spec);
755755
}
756756

757-
if (data->transport_options.negotiation_tips)
757+
if (data->transport_options.negotiation_restrict_tips)
758758
warning("Ignoring --negotiation-tip because the protocol does not support it.");
759759

760760
if (data->fetch)

transport.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static int fetch_refs_via_pack(struct transport *transport,
463463
args.refetch = data->options.refetch;
464464
args.stateless_rpc = transport->stateless_rpc;
465465
args.server_options = transport->server_options;
466-
args.negotiation_tips = data->options.negotiation_tips;
466+
args.negotiation_restrict_tips = data->options.negotiation_restrict_tips;
467467
args.reject_shallow_remote = transport->smart_options->reject_shallow;
468468

469469
if (!data->finished_handshake) {
@@ -491,7 +491,7 @@ static int fetch_refs_via_pack(struct transport *transport,
491491
warning(_("server does not support wait-for-done"));
492492
ret = -1;
493493
} else {
494-
negotiate_using_fetch(data->options.negotiation_tips,
494+
negotiate_using_fetch(data->options.negotiation_restrict_tips,
495495
transport->server_options,
496496
transport->stateless_rpc,
497497
data->fd,
@@ -979,9 +979,9 @@ static int disconnect_git(struct transport *transport)
979979
finish_connect(data->conn);
980980
}
981981

982-
if (data->options.negotiation_tips) {
983-
oid_array_clear(data->options.negotiation_tips);
984-
free(data->options.negotiation_tips);
982+
if (data->options.negotiation_restrict_tips) {
983+
oid_array_clear(data->options.negotiation_restrict_tips);
984+
free(data->options.negotiation_restrict_tips);
985985
}
986986
list_objects_filter_release(&data->options.filter_options);
987987
oid_array_clear(&data->extra_have);

transport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ struct git_transport_options {
4040

4141
/*
4242
* This is only used during fetch. See the documentation of
43-
* negotiation_tips in struct fetch_pack_args.
43+
* negotiation_restrict_tips in struct fetch_pack_args.
4444
*
4545
* This field is only supported by transports that support connect or
4646
* stateless_connect. Set this field directly instead of using
4747
* transport_set_option().
4848
*/
49-
struct oid_array *negotiation_tips;
49+
struct oid_array *negotiation_restrict_tips;
5050

5151
/*
5252
* If allocated, whenever transport_fetch_refs() is called, add known

0 commit comments

Comments
 (0)