1601
else
1602
warning(_("ignoring %s because the protocol does not support it"),
1603
"--negotiation-restrict");
1604
+ } else if (remote->negotiation_restrict.nr) {
1605
+ struct string_list_item *item;
1606
+ for_each_string_list_item(item, &remote->negotiation_restrict)
1607
+ string_list_append(&negotiation_restrict, item->string);
1608
+ if (transport->smart_options)
1609
+ add_negotiation_restrict_tips(transport->smart_options);
1610
+ else {
1611
+ struct strbuf config_name = STRBUF_INIT;
1612
+ strbuf_addf(&config_name, "remote.%s.negotiationRestrict", remote->name);
1613
+ warning(_("ignoring %s because the protocol does not support it"),
1614
+ config_name.buf);
1615
+ strbuf_release(&config_name);
1616
+ }
1617
}
1618
return transport;
1619
}
2671
config.display_format = DISPLAY_FORMAT_PORCELAIN;
2672
}
2673
2661
- if (negotiate_only && !negotiation_restrict.nr)
2662
- die(_("%s needs one or more %s"), "--negotiate-only",
2663
- "--negotiation-restrict=*");
2664
-
2674
if (deepen_relative) {
2675
if (deepen_relative < 0)
2676
die(_("negative depth in --deepen is not supported"));
2758
if (!remote)
2759
die(_("must supply remote when using --negotiate-only"));
2760
gtransport = prepare_transport(remote, 1, &filter_options);
2752
- if (gtransport->smart_options) {
2753
- gtransport->smart_options->acked_commits = &acked_commits;
2754
- } else {
2761
+
2762
+ if (!gtransport->smart_options) {
2763
warning(_("protocol does not support --negotiate-only, exiting"));
2764
result = 1;
2765
trace2_region_leave("fetch", "negotiate-only", the_repository);
2766
goto cleanup;
2767
}
2768
+ if (!gtransport->smart_options->negotiation_restrict_tips)
2769
+ die(_("%s needs one or more %s"), "--negotiate-only",
2770
+ "--negotiation-restrict=*");
2771
+
2772
+ gtransport->smart_options->acked_commits = &acked_commits;
2773
+
2774
if (server_options.nr)
2775
gtransport->server_options = &server_options;
2776
result = transport_fetch_refs(gtransport, NULL);