Skip to content

Commit 1d25e5b

Browse files
newrengitster
authored andcommitted
t7601: add tests of interactions with multiple merge heads and config
There were already code checking that --rebase was incompatible with a merge of multiple heads. However, we were sometimes throwing warnings about lack of specification of rebase vs. merge when given multiple heads. Since rebasing is disallowed with multiple merge heads, that seems like a poor warning to print; we should instead just assume merging is wanted. Add a few tests checking multiple merge head behavior. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent be19c5c commit 1d25e5b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

t/t7601-merge-pull-config.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,28 @@ test_expect_success 'pull.rebase=false and --ff, ff not possible' '
325325

326326
# End of groupings for conflicting merge vs. rebase flags/options
327327

328+
test_expect_failure 'Multiple heads warns about inability to fast forward' '
329+
git reset --hard c1 &&
330+
test_must_fail git pull . c2 c3 2>err &&
331+
test_i18ngrep "Pulling without specifying how to reconcile" err
332+
'
333+
334+
test_expect_failure 'Multiple can never be fast forwarded' '
335+
git reset --hard c0 &&
336+
test_must_fail git -c pull.ff=only pull . c1 c2 c3 2>err &&
337+
test_i18ngrep ! "Pulling without specifying how to reconcile" err &&
338+
# In addition to calling out "cannot fast-forward", we very much
339+
# want the "multiple branches" piece to be called out to users.
340+
test_i18ngrep "Cannot fast-forward to multiple branches" err
341+
'
342+
343+
test_expect_success 'Cannot rebase with multiple heads' '
344+
git reset --hard c0 &&
345+
test_must_fail git -c pull.rebase=true pull . c1 c2 c3 2>err &&
346+
test_i18ngrep ! "Pulling without specifying how to reconcile" err &&
347+
test_i18ngrep "Cannot rebase onto multiple branches." err
348+
'
349+
328350
test_expect_success 'merge c1 with c2' '
329351
git reset --hard c1 &&
330352
test -f c0.c &&

0 commit comments

Comments
 (0)