@@ -1013,7 +1013,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]);
- if (default_mode && opt_verbosity >= 0 && !opt_ff) {
+ if (default_mode && !can_ff && opt_verbosity >= 0 && !opt_ff) {
warning(_("Pulling without specifying how to reconcile divergent branches is\n"
"discouraged. You can squelch this message by running one of the following\n"
"commands sometime before your next pull:\n"
@@ -28,59 +28,65 @@ test_expect_success 'setup' '
'
test_expect_success 'pull.rebase not set' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
git pull . c1 2>err &&
test_i18ngrep "Pulling without specifying how to reconcile" err
'
-test_expect_success 'pull.rebase not set and pull.ff=true' '
+test_expect_success 'pull.rebase not set (fast-forward)' '
git reset --hard c0 &&
+ git pull . c1 2>err &&
+ test_i18ngrep ! "Pulling without specifying how to reconcile" err
+'
+
+test_expect_success 'pull.rebase not set and pull.ff=true' '
+ git reset --hard c2 &&
test_config pull.ff true &&
git pull . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and pull.ff=false' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
test_config pull.ff false &&
git pull . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and pull.ff=only' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
test_config pull.ff only &&
- git pull . c1 2>err &&
+ test_must_fail git pull . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and --rebase given' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
git pull --rebase . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and --no-rebase given' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
git pull --no-rebase . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and --ff given' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
git pull --ff . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and --no-ff given' '
- git reset --hard c0 &&
+ git reset --hard c2 &&
git pull --no-ff . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
test_expect_success 'pull.rebase not set and --ff-only given' '
- git reset --hard c0 &&
- git pull --ff-only . c1 2>err &&
+ git reset --hard c2 &&
+ test_must_fail git pull --ff-only . c1 2>err &&
test_i18ngrep ! "Pulling without specifying how to reconcile" err
'
There's no need to display the annoying warning on every pull... only the ones that are not fast-forward. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- builtin/pull.c | 2 +- t/t7601-merge-pull-config.sh | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-)