summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-12-12 16:52:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-16 01:39:42 (GMT)
commitc525de335e4a3919d49a9126b76d1288f35737be (patch)
tree7f27847036306c8ac80325a37680ce64219b54fd /builtin
parent7539fdc6290750c617c0b638c2f3b2f63c389ed3 (diff)
downloadgit-c525de335e4a3919d49a9126b76d1288f35737be.zip
git-c525de335e4a3919d49a9126b76d1288f35737be.tar.gz
git-c525de335e4a3919d49a9126b76d1288f35737be.tar.bz2
pull: display default warning only when non-ff
There's no need to display the annoying warning on every pull... only the ones that are not fast-forward. The current warning tests still pass, but not because of the arguments or the configuration, but because they are all fast-forward. We need to test non-fast-forward situations now. Suggestions-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pull.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 1b87ea9..e8927fc 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -949,6 +949,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
struct object_id rebase_fork_point;
int autostash;
int rebase_unspecified = 0;
+ int can_ff;
if (!getenv("GIT_REFLOG_ACTION"))
set_reflog_message(argc, argv);
@@ -1044,7 +1045,9 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (opt_rebase && merge_heads.nr > 1)
die(_("Cannot rebase onto multiple branches."));
- if (rebase_unspecified && !opt_ff) {
+ 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();
}
@@ -1063,7 +1066,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
submodule_touches_in_range(the_repository, &upstream, &curr_head))
die(_("cannot rebase with locally recorded submodule modifications"));
if (!autostash) {
- if (get_can_ff(&orig_head, &merge_heads.oid[0])) {
+ if (can_ff) {
/* we can fast-forward this without invoking rebase */
opt_ff = "--ff-only";
ran_ff = 1;