2009-08-09 14:01:48 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='test auto-generated merge messages'
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
check_oneline() {
|
|
|
|
echo "$1" | sed "s/Q/'/g" >expect &&
|
|
|
|
git log -1 --pretty=tformat:%s >actual &&
|
|
|
|
test_cmp expect actual
|
|
|
|
}
|
|
|
|
|
|
|
|
test_expect_success 'merge local branch' '
|
|
|
|
test_commit master-1 &&
|
|
|
|
git checkout -b local-branch &&
|
|
|
|
test_commit branch-1 &&
|
|
|
|
git checkout master &&
|
|
|
|
test_commit master-2 &&
|
|
|
|
git merge local-branch &&
|
|
|
|
check_oneline "Merge branch Qlocal-branchQ"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge octopus branches' '
|
|
|
|
git checkout -b octopus-a master &&
|
|
|
|
test_commit octopus-1 &&
|
|
|
|
git checkout -b octopus-b master &&
|
|
|
|
test_commit octopus-2 &&
|
|
|
|
git checkout master &&
|
|
|
|
git merge octopus-a octopus-b &&
|
|
|
|
check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge tag' '
|
|
|
|
git checkout -b tag-branch master &&
|
|
|
|
test_commit tag-1 &&
|
|
|
|
git checkout master &&
|
|
|
|
test_commit master-3 &&
|
|
|
|
git merge tag-1 &&
|
2011-11-05 08:31:28 +04:00
|
|
|
check_oneline "Merge tag Qtag-1Q"
|
2009-08-09 14:01:48 +04:00
|
|
|
'
|
|
|
|
|
merge: fix incorrect merge message for ambiguous tag/branch
If we have both a tag and a branch named "foo", then calling
"git merge foo" will warn about the ambiguous ref, but merge
the tag.
When generating the commit message, though, we simply
checked whether "refs/heads/foo" existed, and if it did,
assumed it was a branch. This led to the statement "Merge
branch 'foo'" in the commit message, which is quite wrong.
Instead, we should use dwim_ref to find the actual ref used,
and describe it appropriately.
In addition to the test in t7608, we must also tweak the
expected output of t4202, which was accidentally triggering
this bug.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-09 14:02:24 +04:00
|
|
|
test_expect_success 'ambiguous tag' '
|
2009-08-09 14:01:48 +04:00
|
|
|
git checkout -b ambiguous master &&
|
|
|
|
test_commit ambiguous &&
|
|
|
|
git checkout master &&
|
|
|
|
test_commit master-4 &&
|
|
|
|
git merge ambiguous &&
|
2011-11-05 08:31:28 +04:00
|
|
|
check_oneline "Merge tag QambiguousQ"
|
2009-08-09 14:01:48 +04:00
|
|
|
'
|
|
|
|
|
2010-11-02 18:31:25 +03:00
|
|
|
test_expect_success 'remote-tracking branch' '
|
2009-08-09 14:02:51 +04:00
|
|
|
git checkout -b remote master &&
|
|
|
|
test_commit remote-1 &&
|
|
|
|
git update-ref refs/remotes/origin/master remote &&
|
|
|
|
git checkout master &&
|
|
|
|
test_commit master-5 &&
|
|
|
|
git merge origin/master &&
|
2010-11-02 18:31:25 +03:00
|
|
|
check_oneline "Merge remote-tracking branch Qorigin/masterQ"
|
2009-08-09 14:02:51 +04:00
|
|
|
'
|
|
|
|
|
2009-08-09 14:01:48 +04:00
|
|
|
test_done
|