@matheusbsbs / matheus-bagliano / commits / 54200cef86
Fork 0

pull: don't warn if pull.ff has been set

A user who understands enough to set pull.ff does not need additional instructions. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Alex Henrie committed Sep 24, 2020 at 21:50 UTC 54200cef86a67ea6666d02be7f21e66d471624bf
2 files changed +21 -3
builtin/pull.c
+1 -2
@@ -344,8 +344,7 @@ static enum rebase_type config_get_rebase(void)
344 if (!git_config_get_value("pull.rebase", &value))
345 return parse_config_rebase("pull.rebase", value, 1);
346
347 - if (opt_verbosity >= 0 &&
348 - (!opt_ff || strcmp(opt_ff, "--ff-only"))) {
347 + if (opt_verbosity >= 0 && !opt_ff) {
348 warning(_("Pulling without specifying how to reconcile divergent branches is\n"
349 "discouraged. You can squelch this message by running one of the following\n"
350 "commands sometime before your next pull:\n"
t/t7601-merge-pull-config.sh
+20 -1
@@ -33,11 +33,18 @@ test_expect_success 'pull.rebase not set' '
33 test_i18ngrep "Pulling without specifying how to reconcile" err
34 '
35
36 +test_expect_success 'pull.rebase not set and pull.ff=true' '
37 + git reset --hard c0 &&
38 + test_config pull.ff true &&
39 + git pull . c1 2>err &&
40 + test_i18ngrep ! "Pulling without specifying how to reconcile" err
41 +'
42 +
43 test_expect_success 'pull.rebase not set and pull.ff=false' '
44 git reset --hard c0 &&
45 test_config pull.ff false &&
46 git pull . c1 2>err &&
40 - test_i18ngrep "Pulling without specifying how to reconcile" err
47 + test_i18ngrep ! "Pulling without specifying how to reconcile" err
48 '
49
50 test_expect_success 'pull.rebase not set and pull.ff=only' '
@@ -59,6 +66,18 @@ test_expect_success 'pull.rebase not set and --no-rebase given' '
66 test_i18ngrep ! "Pulling without specifying how to reconcile" err
67 '
68
69 +test_expect_success 'pull.rebase not set and --ff given' '
70 + git reset --hard c0 &&
71 + git pull --ff . c1 2>err &&
72 + test_i18ngrep ! "Pulling without specifying how to reconcile" err
73 +'
74 +
75 +test_expect_success 'pull.rebase not set and --no-ff given' '
76 + git reset --hard c0 &&
77 + git pull --no-ff . c1 2>err &&
78 + test_i18ngrep ! "Pulling without specifying how to reconcile" err
79 +'
80 +
81 test_expect_success 'pull.rebase not set and --ff-only given' '
82 git reset --hard c0 &&
83 git pull --ff-only . c1 2>err &&