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:
authorErwin Villejo <erwin.villejo@gmail.com>2021-11-17 10:55:50 +0300
committerJunio C Hamano <gitster@pobox.com>2021-11-19 01:38:53 +0300
commitea1954af771253660cd84dc73b8f2832327c9c02 (patch)
treefc4ff432663177f70df17343ce72a1ce214f9a43 /builtin/pull.c
parent361cb52383fb986f76a34506bdec9a1dd11133f0 (diff)
pull: should be noop when already-up-to-date
The already-up-to-date pull bug was fixed for --ff-only but it did not include the case where --ff or --ff-only are not specified. This updates the --ff-only fix to include the case where --ff or --ff-only are not specified in command line flags or config. Signed-off-by: Erwin Villejo <erwin.villejo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pull.c')
-rw-r--r--builtin/pull.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 54286b544f..6ff2a8196e 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -984,6 +984,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
struct object_id rebase_fork_point;
int rebase_unspecified = 0;
int can_ff;
+ int divergent;
if (!getenv("GIT_REFLOG_ACTION"))
set_reflog_message(argc, argv);
@@ -1098,15 +1099,16 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
}
can_ff = get_can_ff(&orig_head, &merge_heads);
+ divergent = !can_ff && !already_up_to_date(&orig_head, &merge_heads);
/* ff-only takes precedence over rebase */
if (opt_ff && !strcmp(opt_ff, "--ff-only")) {
- if (!can_ff && !already_up_to_date(&orig_head, &merge_heads))
+ if (divergent)
die_ff_impossible();
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 && divergent) {
show_advice_pull_non_ff();
die(_("Need to specify how to reconcile divergent branches."));
}