Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2021-07-21 04:42:19 +0300
committerJunio C Hamano <gitster@pobox.com>2021-07-21 07:43:12 +0300
commit3d5fc24daefbdf56bc36a491aed0b7990fa0c62f (patch)
treeef359b69c3e219588b10455b6fe7d89976df9f93 /builtin/pull.c
parent1d25e5bdf5263a227d233eafcf028b36c72716f6 (diff)
pull: abort if --ff-only is given and fast-forwarding is impossible
The warning about pulling without specifying how to reconcile divergent branches says that after setting pull.rebase to true, --ff-only can still be passed on the command line to require a fast-forward. Make that actually work. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> [en: updated tests; note 3 fixes and 1 new failure] 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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 3e13f81084..d979660482 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -1046,9 +1046,14 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]);
- if (rebase_unspecified && !opt_ff && !can_ff) {
- if (opt_verbosity >= 0)
- show_advice_pull_non_ff();
+ if (!can_ff) {
+ if (opt_ff) {
+ if (!strcmp(opt_ff, "--ff-only"))
+ die_ff_impossible();
+ } else {
+ if (rebase_unspecified && opt_verbosity >= 0)
+ show_advice_pull_non_ff();
+ }
}
if (opt_rebase) {