Skip to content

Commit 9f471e4

Browse files
committed
Merge branch 'rs/pull-options-sync-code-and-doc'
"git pull" shares many options with underlying "git fetch", but some of them were not documented and some of those that would make sense to pass down were not passed down. * rs/pull-options-sync-code-and-doc: pull: pass documented fetch options on pull: remove --update-head-ok from documentation
2 parents 7780604 + 13ac5ed commit 9f471e4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Documentation/fetch-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ ifndef::git-pull[]
204204
recursion (such as settings in linkgit:gitmodules[5] and
205205
linkgit:git-config[1]) override this option, as does
206206
specifying --[no-]recurse-submodules directly.
207-
endif::git-pull[]
208207

209208
-u::
210209
--update-head-ok::
@@ -214,6 +213,7 @@ endif::git-pull[]
214213
to communicate with 'git fetch', and unless you are
215214
implementing your own Porcelain you are not supposed to
216215
use it.
216+
endif::git-pull[]
217217

218218
--upload-pack <upload-pack>::
219219
When given, and the repository to fetch from is handled

builtin/pull.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ static char *opt_ipv4;
110110
static char *opt_ipv6;
111111
static int opt_show_forced_updates = -1;
112112
static char *set_upstream;
113+
static struct argv_array opt_fetch = ARGV_ARRAY_INIT;
113114

114115
static struct option pull_options[] = {
115116
/* Shared options */
@@ -207,6 +208,15 @@ static struct option pull_options[] = {
207208
OPT_PASSTHRU(0, "depth", &opt_depth, N_("depth"),
208209
N_("deepen history of shallow clone"),
209210
0),
211+
OPT_PASSTHRU_ARGV(0, "shallow-since", &opt_fetch, N_("time"),
212+
N_("deepen history of shallow repository based on time"),
213+
0),
214+
OPT_PASSTHRU_ARGV(0, "shallow-exclude", &opt_fetch, N_("revision"),
215+
N_("deepen history of shallow clone, excluding rev"),
216+
0),
217+
OPT_PASSTHRU_ARGV(0, "deepen", &opt_fetch, N_("n"),
218+
N_("deepen history of shallow clone"),
219+
0),
210220
OPT_PASSTHRU(0, "unshallow", &opt_unshallow, NULL,
211221
N_("convert to a complete repository"),
212222
PARSE_OPT_NONEG | PARSE_OPT_NOARG),
@@ -216,12 +226,19 @@ static struct option pull_options[] = {
216226
OPT_PASSTHRU(0, "refmap", &opt_refmap, N_("refmap"),
217227
N_("specify fetch refmap"),
218228
PARSE_OPT_NONEG),
229+
OPT_PASSTHRU_ARGV('o', "server-option", &opt_fetch,
230+
N_("server-specific"),
231+
N_("option to transmit"),
232+
0),
219233
OPT_PASSTHRU('4', "ipv4", &opt_ipv4, NULL,
220234
N_("use IPv4 addresses only"),
221235
PARSE_OPT_NOARG),
222236
OPT_PASSTHRU('6', "ipv6", &opt_ipv6, NULL,
223237
N_("use IPv6 addresses only"),
224238
PARSE_OPT_NOARG),
239+
OPT_PASSTHRU_ARGV(0, "negotiation-tip", &opt_fetch, N_("revision"),
240+
N_("report that we have only objects reachable from this object"),
241+
0),
225242
OPT_BOOL(0, "show-forced-updates", &opt_show_forced_updates,
226243
N_("check for forced-updates on all updated branches")),
227244
OPT_PASSTHRU(0, "set-upstream", &set_upstream, NULL,
@@ -567,6 +584,7 @@ static int run_fetch(const char *repo, const char **refspecs)
567584
argv_array_push(&args, "--no-show-forced-updates");
568585
if (set_upstream)
569586
argv_array_push(&args, set_upstream);
587+
argv_array_pushv(&args, opt_fetch.argv);
570588

571589
if (repo) {
572590
argv_array_push(&args, repo);

0 commit comments

Comments
 (0)