Skip to content

Commit 299deea

Browse files
committed
Merge branch 'ah/pull'
Earlier we taught "git pull" to warn when the user does not say the histories need to be merged, rebased or accepts only fast- forwarding, but the warning triggered for those who have set the pull.ff configuration variable. * ah/pull: pull: don't warn if pull.ff has been set
2 parents ac4089d + 54200ce commit 299deea

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

builtin/pull.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ static enum rebase_type config_get_rebase(void)
344344
if (!git_config_get_value("pull.rebase", &value))
345345
return parse_config_rebase("pull.rebase", value, 1);
346346

347-
if (opt_verbosity >= 0 &&
348-
(!opt_ff || strcmp(opt_ff, "--ff-only"))) {
347+
if (opt_verbosity >= 0 && !opt_ff) {
349348
warning(_("Pulling without specifying how to reconcile divergent branches is\n"
350349
"discouraged. You can squelch this message by running one of the following\n"
351350
"commands sometime before your next pull:\n"

t/t7601-merge-pull-config.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ test_expect_success 'pull.rebase not set' '
3333
test_i18ngrep "Pulling without specifying how to reconcile" err
3434
'
3535

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+
3643
test_expect_success 'pull.rebase not set and pull.ff=false' '
3744
git reset --hard c0 &&
3845
test_config pull.ff false &&
3946
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
4148
'
4249

4350
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' '
5966
test_i18ngrep ! "Pulling without specifying how to reconcile" err
6067
'
6168

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+
6281
test_expect_success 'pull.rebase not set and --ff-only given' '
6382
git reset --hard c0 &&
6483
git pull --ff-only . c1 2>err &&

0 commit comments

Comments
 (0)