summaryrefslogtreecommitdiff
path: root/builtin/pull.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-11-22 05:57:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-22 05:57:04 (GMT)
commit0f2140f105ded522ebfd784ae3e7f0885302513f (patch)
tree27651d488d9f3829abbf8e4c1581833a222d361d /builtin/pull.c
parentccd3258b4d6af2f7b9b331a09543fdc8325ff170 (diff)
parentea1954af771253660cd84dc73b8f2832327c9c02 (diff)
downloadgit-0f2140f105ded522ebfd784ae3e7f0885302513f.zip
git-0f2140f105ded522ebfd784ae3e7f0885302513f.tar.gz
git-0f2140f105ded522ebfd784ae3e7f0885302513f.tar.bz2
Merge branch 'ev/pull-already-up-to-date-is-noop'
"git pull" with any strategy when the other side is behind us should succeed as it is a no-op, but doesn't. * ev/pull-already-up-to-date-is-noop: pull: should be noop when already-up-to-date
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 127798b..1cfaf9f 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -988,6 +988,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);
@@ -1102,15 +1103,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."));
}