]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pull: pass documented fetch options on
authorRené Scharfe <l.s.r@web.de>
Sat, 28 Mar 2020 14:48:41 +0000 (15:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 29 Mar 2020 01:13:11 +0000 (18:13 -0700)
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>
builtin/pull.c

index d25ff13a60f2d08efdc160c359364ab94a5b19ae..2b9b1bc1615d18d9f49fd30fd0982c15665d8165 100644 (file)
@@ -130,6 +130,7 @@ static char *opt_ipv4;
 static char *opt_ipv6;
 static int opt_show_forced_updates = -1;
 static char *set_upstream;
+static struct argv_array opt_fetch = ARGV_ARRAY_INIT;
 
 static struct option pull_options[] = {
        /* Shared options */
@@ -227,6 +228,15 @@ static struct option pull_options[] = {
        OPT_PASSTHRU(0, "depth", &opt_depth, N_("depth"),
                N_("deepen history of shallow clone"),
                0),
+       OPT_PASSTHRU_ARGV(0, "shallow-since", &opt_fetch, N_("time"),
+               N_("deepen history of shallow repository based on time"),
+               0),
+       OPT_PASSTHRU_ARGV(0, "shallow-exclude", &opt_fetch, N_("revision"),
+               N_("deepen history of shallow clone, excluding rev"),
+               0),
+       OPT_PASSTHRU_ARGV(0, "deepen", &opt_fetch, N_("n"),
+               N_("deepen history of shallow clone"),
+               0),
        OPT_PASSTHRU(0, "unshallow", &opt_unshallow, NULL,
                N_("convert to a complete repository"),
                PARSE_OPT_NONEG | PARSE_OPT_NOARG),
@@ -236,12 +246,19 @@ static struct option pull_options[] = {
        OPT_PASSTHRU(0, "refmap", &opt_refmap, N_("refmap"),
                N_("specify fetch refmap"),
                PARSE_OPT_NONEG),
+       OPT_PASSTHRU_ARGV('o', "server-option", &opt_fetch,
+               N_("server-specific"),
+               N_("option to transmit"),
+               0),
        OPT_PASSTHRU('4',  "ipv4", &opt_ipv4, NULL,
                N_("use IPv4 addresses only"),
                PARSE_OPT_NOARG),
        OPT_PASSTHRU('6',  "ipv6", &opt_ipv6, NULL,
                N_("use IPv6 addresses only"),
                PARSE_OPT_NOARG),
+       OPT_PASSTHRU_ARGV(0, "negotiation-tip", &opt_fetch, N_("revision"),
+               N_("report that we have only objects reachable from this object"),
+               0),
        OPT_BOOL(0, "show-forced-updates", &opt_show_forced_updates,
                 N_("check for forced-updates on all updated branches")),
        OPT_PASSTHRU(0, "set-upstream", &set_upstream, NULL,
@@ -562,6 +579,7 @@ static int run_fetch(const char *repo, const char **refspecs)
                argv_array_push(&args, "--no-show-forced-updates");
        if (set_upstream)
                argv_array_push(&args, set_upstream);
+       argv_array_pushv(&args, opt_fetch.argv);
 
        if (repo) {
                argv_array_push(&args, repo);