Skip to content

Commit 3883c55

Browse files
derrickstoleegitster
authored andcommitted
pull: add --[no-]show-forced-updates passthrough
The 'git fetch' command can avoid calculating forced updates, so allow users of 'git pull' to provide that option. This is particularly necessary when the advice to use '--no-show-forced-updates' is given at the end of the command. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 377444b commit 3883c55

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin/pull.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ static char *opt_update_shallow;
128128
static char *opt_refmap;
129129
static char *opt_ipv4;
130130
static char *opt_ipv6;
131+
static int opt_show_forced_updates = -1;
131132

132133
static struct option pull_options[] = {
133134
/* Shared options */
@@ -240,6 +241,8 @@ static struct option pull_options[] = {
240241
OPT_PASSTHRU('6', "ipv6", &opt_ipv6, NULL,
241242
N_("use IPv6 addresses only"),
242243
PARSE_OPT_NOARG),
244+
OPT_BOOL(0, "show-forced-updates", &opt_show_forced_updates,
245+
N_("check for forced-updates on all updated branches")),
243246

244247
OPT_END()
245248
};
@@ -549,6 +552,10 @@ static int run_fetch(const char *repo, const char **refspecs)
549552
argv_array_push(&args, opt_ipv4);
550553
if (opt_ipv6)
551554
argv_array_push(&args, opt_ipv6);
555+
if (opt_show_forced_updates > 0)
556+
argv_array_push(&args, "--show-forced-updates");
557+
else if (opt_show_forced_updates == 0)
558+
argv_array_push(&args, "--no-show-forced-updates");
552559

553560
if (repo) {
554561
argv_array_push(&args, repo);

0 commit comments

Comments
 (0)