summaryrefslogtreecommitdiff
path: root/builtin/pull.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-07-22 05:04:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-22 18:54:29 (GMT)
commitadc27d6a9374d012b091bc348c20f5bfdbee52d1 (patch)
treeab53d1e016d9d40cb68ff97227c446addb670044 /builtin/pull.c
parente4dc25ed49d94c93b1d3f63efe17f32ca682cab7 (diff)
downloadgit-adc27d6a9374d012b091bc348c20f5bfdbee52d1.zip
git-adc27d6a9374d012b091bc348c20f5bfdbee52d1.tar.gz
git-adc27d6a9374d012b091bc348c20f5bfdbee52d1.tar.bz2
pull: make --rebase and --no-rebase override pull.ff=only
Fix the last few precedence tests failing in t7601 by now implementing the logic to have --[no-]rebase override a pull.ff=only config setting. 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.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 1f45202..9bf0325 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -966,8 +966,22 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
parse_repo_refspecs(argc, argv, &repo, &refspecs);
- if (!opt_ff)
+ if (!opt_ff) {
opt_ff = xstrdup_or_null(config_get_ff());
+ /*
+ * A subtle point: opt_ff was set on the line above via
+ * reading from config. opt_rebase, in contrast, is set
+ * before this point via command line options. The setting
+ * of opt_rebase via reading from config (using
+ * config_get_rebase()) does not happen until later. We
+ * are relying on the next if-condition happening before
+ * the config_get_rebase() call so that an explicit
+ * "--rebase" can override a config setting of
+ * pull.ff=only.
+ */
+ if (opt_rebase >= 0 && opt_ff && !strcmp(opt_ff, "--ff-only"))
+ opt_ff = "--ff";
+ }
if (opt_rebase < 0)
opt_rebase = config_get_rebase(&rebase_unspecified);