@matheusbsbs / matheus-bagliano / commits / 13ac5edbfa
Fork 0

pull: pass documented fetch options on

The fetch options --deepen, --negotiation-tip, --server-option, --shallow-exclude, and --shallow-since are documented for git pull as well, but are not actually accepted by that command. Pass them on to make the code match its documentation. Reported-by: 天几 <muzimuzhi@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Mar 28, 2020 at 15:48 UTC 13ac5edbfa5a03cd9bb4cf6b59dc45f2c73aa463
1 file changed +18
builtin/pull.c
+18
@@ -130,6 +130,7 @@ static char *opt_ipv4;
130 static char *opt_ipv6;
131 static int opt_show_forced_updates = -1;
132 static char *set_upstream;
133 +static struct argv_array opt_fetch = ARGV_ARRAY_INIT;
134
135 static struct option pull_options[] = {
136 /* Shared options */
@@ -227,6 +228,15 @@ static struct option pull_options[] = {
228 OPT_PASSTHRU(0, "depth", &opt_depth, N_("depth"),
229 N_("deepen history of shallow clone"),
230 0),
231 + OPT_PASSTHRU_ARGV(0, "shallow-since", &opt_fetch, N_("time"),
232 + N_("deepen history of shallow repository based on time"),
233 + 0),
234 + OPT_PASSTHRU_ARGV(0, "shallow-exclude", &opt_fetch, N_("revision"),
235 + N_("deepen history of shallow clone, excluding rev"),
236 + 0),
237 + OPT_PASSTHRU_ARGV(0, "deepen", &opt_fetch, N_("n"),
238 + N_("deepen history of shallow clone"),
239 + 0),
240 OPT_PASSTHRU(0, "unshallow", &opt_unshallow, NULL,
241 N_("convert to a complete repository"),
242 PARSE_OPT_NONEG | PARSE_OPT_NOARG),
@@ -236,12 +246,19 @@ static struct option pull_options[] = {
246 OPT_PASSTHRU(0, "refmap", &opt_refmap, N_("refmap"),
247 N_("specify fetch refmap"),
248 PARSE_OPT_NONEG),
249 + OPT_PASSTHRU_ARGV('o', "server-option", &opt_fetch,
250 + N_("server-specific"),
251 + N_("option to transmit"),
252 + 0),
253 OPT_PASSTHRU('4', "ipv4", &opt_ipv4, NULL,
254 N_("use IPv4 addresses only"),
255 PARSE_OPT_NOARG),
256 OPT_PASSTHRU('6', "ipv6", &opt_ipv6, NULL,
257 N_("use IPv6 addresses only"),
258 PARSE_OPT_NOARG),
259 + OPT_PASSTHRU_ARGV(0, "negotiation-tip", &opt_fetch, N_("revision"),
260 + N_("report that we have only objects reachable from this object"),
261 + 0),
262 OPT_BOOL(0, "show-forced-updates", &opt_show_forced_updates,
263 N_("check for forced-updates on all updated branches")),
264 OPT_PASSTHRU(0, "set-upstream", &set_upstream, NULL,
@@ -562,6 +579,7 @@ static int run_fetch(const char *repo, const char **refspecs)
579 argv_array_push(&args, "--no-show-forced-updates");
580 if (set_upstream)
581 argv_array_push(&args, set_upstream);
582 + argv_array_pushv(&args, opt_fetch.argv);
583
584 if (repo) {
585 argv_array_push(&args, repo);