]> git.ipfire.org Git - thirdparty/git.git/commit
pull: --ff-only should make it a noop when already-up-to-date
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 Oct 2021 17:28:44 +0000 (10:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Oct 2021 07:15:39 +0000 (00:15 -0700)
commit361cb52383fb986f76a34506bdec9a1dd11133f0
treebafea74882456172c9ed5982cce4d549e31c4360
parentaf6d1d602a8f64164b266364339c4e936d5bbc33
pull: --ff-only should make it a noop when already-up-to-date

Earlier, we made sure that "git pull --ff-only" (and "git -c
pull.ff=only pull") errors out when our current HEAD is not an
ancestor of the tip of the history we are merging, but the condition
to trigger the error was implemented incorrectly.

Imagine you forked from a remote branch, built your history on top
of it, and then attempted to pull from them again.  If they have not
made any update in the meantime, our current HEAD is obviously not
their ancestor, and this new error triggers.

Without the --ff-only option, we just report that there is no need
to pull; we did the same historically with --ff-only, too.

Make sure we do not fail with the recently added check to restore
the historical behaviour.

Reported-by: Kenneth Arnold <ka37@calvin.edu>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pull.c
t/t7601-merge-pull-config.sh