aboutsummaryrefslogtreecommitdiff
path: root/builtin/pull.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-29 12:59:08 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-29 12:59:08 -0700
commit175008d45474ff78ca9e3dcf038df359a97b4d92 (patch)
tree7dc4add353d353d40a49a1c440d186e4c134cd07 /builtin/pull.c
parentd689301043f6dc14d71e7d33e1b8ea600ae1b67b (diff)
parent09c2cb877a9cc0f6f25eac8d43663f4e8f3309a4 (diff)
downloadgit-175008d45474ff78ca9e3dcf038df359a97b4d92.tar.gz
git-175008d45474ff78ca9e3dcf038df359a97b4d92.tar.xz
Merge branch 'jc/merge-refuse-new-root'
"git pull" has been taught to pass --allow-unrelated-histories option to underlying "git merge". * jc/merge-refuse-new-root: pull: pass --allow-unrelated-histories to "git merge" t3033: avoid 'ambiguous refs' warning
Diffstat (limited to 'builtin/pull.c')
-rw-r--r--builtin/pull.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index d98f481d3..596b92fc5 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -91,6 +91,7 @@ static int config_autostash;
static struct argv_array opt_strategies = ARGV_ARRAY_INIT;
static struct argv_array opt_strategy_opts = ARGV_ARRAY_INIT;
static char *opt_gpg_sign;
+static int opt_allow_unrelated_histories;
/* Options passed to git-fetch */
static char *opt_all;
@@ -163,6 +164,9 @@ static struct option pull_options[] = {
OPT_PASSTHRU('S', "gpg-sign", &opt_gpg_sign, N_("key-id"),
N_("GPG sign commit"),
PARSE_OPT_OPTARG),
+ OPT_SET_INT(0, "allow-unrelated-histories",
+ &opt_allow_unrelated_histories,
+ N_("allow merging unrelated histories"), 1),
/* Options passed to git-fetch */
OPT_GROUP(N_("Options related to fetching")),
@@ -628,6 +632,8 @@ static int run_merge(void)
argv_array_pushv(&args, opt_strategy_opts.argv);
if (opt_gpg_sign)
argv_array_push(&args, opt_gpg_sign);
+ if (opt_allow_unrelated_histories > 0)
+ argv_array_push(&args, "--allow-unrelated-histories");
argv_array_push(&args, "FETCH_HEAD");
ret = run_command_v_opt(args.argv, RUN_GIT_CMD);