3 # Copyright (c) 2007 Eric Wong
4 # Based on a script by Joakim Tjernlund <joakim.tjernlund@transmode.se>
6 test_description='git svn dcommit handles merges'
13 # (C) Copyright 2000 - 2005
14 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
16 # See file CREDITS for list of people who contributed to this
19 # This program is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License as
21 # published by the Free Software Foundation; either version 2 of
22 # the License, or (at your option) any later version.
24 # This program is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 test_expect_success 'setup svn repository' '
38 svn_cmd co "$svnrepo" mysvnwork &&
39 mkdir -p mysvnwork/trunk &&
42 big_text_block >>trunk/README &&
44 svn_cmd ci -m "first commit" trunk
48 test_expect_success 'setup git mirror and merge' '
49 git svn init "$svnrepo" -t tags -T trunk -b branches &&
51 git checkout -b svn remotes/origin/trunk &&
52 git checkout -b merge &&
53 echo new file > new_file &&
55 git commit -a -m "New file" &&
56 echo hello >> README &&
57 git commit -a -m "hello" &&
58 echo add some stuff >> new_file &&
59 git commit -a -m "add some stuff" &&
62 echo friend > README &&
64 git commit -a -m "friend" &&
68 test_debug 'gitk --all & sleep 1'
70 test_expect_success 'verify pre-merge ancestry' "
71 test x\$(git rev-parse --verify refs/heads/svn^2) = \
72 x\$(git rev-parse --verify refs/heads/merge) &&
73 git cat-file commit refs/heads/svn^ | grep '^friend$'
76 test_expect_success 'git svn dcommit merges' "
80 test_debug 'gitk --all & sleep 1'
82 test_expect_success 'verify post-merge ancestry' "
83 test x\$(git rev-parse --verify refs/heads/svn) = \
84 x\$(git rev-parse --verify refs/remotes/origin/trunk) &&
85 test x\$(git rev-parse --verify refs/heads/svn^2) = \
86 x\$(git rev-parse --verify refs/heads/merge) &&
87 git cat-file commit refs/heads/svn^ | grep '^friend$'
90 test_expect_success 'verify merge commit message' "
91 git rev-list --pretty=raw -1 refs/heads/svn | \
92 grep \" Merge branch 'merge' into svn\"