aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/pull.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-07-22 05:04:48 +0000
committerJunio C Hamano <gitster@pobox.com>2021-07-22 11:54:29 -0700
commit031e2f7ae195069d00d21cde906fce5b0318dbdd (patch)
tree61c6b5cb09f65ab91fe17c72c7cdfc5d8213c5f0 /builtin/pull.c
parentadc27d6a9374d012b091bc348c20f5bfdbee52d1 (diff)
downloadgit-031e2f7ae195069d00d21cde906fce5b0318dbdd.tar.gz
pull: abort by default when fast-forwarding is not possible
We have for some time shown a long warning when the user does not specify how to reconcile divergent branches with git pull. Make it an error now. Initial-patch-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pull.c')
-rw-r--r--builtin/pull.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 9bf0325529..4514a1478e 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -927,9 +927,9 @@ static int get_can_ff(struct object_id *orig_head, struct object_id *orig_merge_
static void show_advice_pull_non_ff(void)
{
- advise(_("Pulling without specifying how to reconcile divergent branches is\n"
- "discouraged. You can squelch this message by running one of the following\n"
- "commands sometime before your next pull:\n"
+ advise(_("You have divergent branches and need to specify how to reconcile them.\n"
+ "You can do so by running one of the following commands sometime before\n"
+ "your next pull:\n"
"\n"
" git config pull.rebase false # merge (the default strategy)\n"
" git config pull.rebase true # rebase\n"
@@ -1067,8 +1067,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
opt_rebase = REBASE_FALSE;
}
/* If no action specified and we can't fast forward, then warn. */
- if (!opt_ff && rebase_unspecified && !can_ff)
+ if (!opt_ff && rebase_unspecified && !can_ff) {
show_advice_pull_non_ff();
+ die(_("Need to specify how to reconcile divergent branches."));
+ }
if (opt_rebase) {
int ret = 0;