1#!/bin/sh2#3# Copyright (c) 2007 Eric Wong4# Based on a script by Joakim Tjernlund <joakim.tjernlund@transmode.se>56test_description='git svn dcommit handles merges'78. ./lib-git-svn.sh910big_text_block () {11cat << EOF12#13# (C) Copyright 2000 - 200514# Wolfgang Denk, DENX Software Engineering, wd@denx.de.15#16# See file CREDITS for list of people who contributed to this17# project.18#19# This program is free software; you can redistribute it and/or20# modify it under the terms of the GNU General Public License as21# published by the Free Software Foundation; either version 2 of22# the License, or (at your option) any later version.23#24# This program is distributed in the hope that it will be useful,25# but WITHOUT ANY WARRANTY; without even the implied warranty of26# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the27# GNU General Public License for more details.28#29# You should have received a copy of the GNU General Public License30# along with this program; if not, write to the Free Software31# Foundation, Inc., 59 Temple Place, Suite 330, Boston,32# MA 02111-1307 USA33#34EOF35}3637test_expect_success 'setup svn repository' '38svn_cmd co "$svnrepo" mysvnwork &&39mkdir -p mysvnwork/trunk &&40(41cd mysvnwork &&42big_text_block >>trunk/README &&43svn_cmd add trunk &&44svn_cmd ci -m "first commit" trunk45)46'4748test_expect_success 'setup git mirror and merge' '49git svn init "$svnrepo" -t tags -T trunk -b branches &&50git svn fetch &&51git checkout -b svn remotes/origin/trunk &&52git checkout -b merge &&53echo new file > new_file &&54git add new_file &&55git commit -a -m "New file" &&56echo hello >> README &&57git commit -a -m "hello" &&58echo add some stuff >> new_file &&59git commit -a -m "add some stuff" &&60git checkout svn &&61mv -f README tmp &&62echo friend > README &&63cat tmp >> README &&64git commit -a -m "friend" &&65git merge merge66'6768test_debug 'gitk --all & sleep 1'6970test_expect_success 'verify pre-merge ancestry' "71test x\$(git rev-parse --verify refs/heads/svn^2) = \72x\$(git rev-parse --verify refs/heads/merge) &&73git cat-file commit refs/heads/svn^ | grep '^friend$'74"7576test_expect_success 'git svn dcommit merges' "77git svn dcommit78"7980test_debug 'gitk --all & sleep 1'8182test_expect_success 'verify post-merge ancestry' "83test x\$(git rev-parse --verify refs/heads/svn) = \84x\$(git rev-parse --verify refs/remotes/origin/trunk) &&85test x\$(git rev-parse --verify refs/heads/svn^2) = \86x\$(git rev-parse --verify refs/heads/merge) &&87git cat-file commit refs/heads/svn^ | grep '^friend$'88"8990test_expect_success 'verify merge commit message' "91git rev-list --pretty=raw -1 refs/heads/svn | \92grep \" Merge branch 'merge' into svn\"93"9495test_done