parse-opts: add OPT_FILENAME and transition builtins
[git/mingw.git] / t / t9114-git-svn-dcommit-merge.sh
blob84f7c9b4bb00931b57740be32ce7ee29bbb26694
1 #!/bin/sh
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'
8 . ./lib-git-svn.sh
10 big_text_block () {
11 cat << EOF
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
17 # project.
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,
32 # MA 02111-1307 USA
34 EOF
37 test_expect_success 'setup svn repository' '
38 svn_cmd co "$svnrepo" mysvnwork &&
39 mkdir -p mysvnwork/trunk &&
40 cd mysvnwork &&
41 big_text_block >> trunk/README &&
42 svn_cmd add trunk &&
43 svn_cmd ci -m "first commit" trunk &&
44 cd ..
47 test_expect_success 'setup git mirror and merge' '
48 git svn init "$svnrepo" -t tags -T trunk -b branches &&
49 git svn fetch &&
50 git checkout --track -b svn remotes/trunk &&
51 git checkout -b merge &&
52 echo new file > new_file &&
53 git add new_file &&
54 git commit -a -m "New file" &&
55 echo hello >> README &&
56 git commit -a -m "hello" &&
57 echo add some stuff >> new_file &&
58 git commit -a -m "add some stuff" &&
59 git checkout svn &&
60 mv -f README tmp &&
61 echo friend > README &&
62 cat tmp >> README &&
63 git commit -a -m "friend" &&
64 git pull . merge
67 test_debug 'gitk --all & sleep 1'
69 test_expect_success 'verify pre-merge ancestry' "
70 test x\`git rev-parse --verify refs/heads/svn^2\` = \
71 x\`git rev-parse --verify refs/heads/merge\` &&
72 git cat-file commit refs/heads/svn^ | grep '^friend$'
75 test_expect_success 'git svn dcommit merges' "
76 git svn dcommit
79 test_debug 'gitk --all & sleep 1'
81 test_expect_success 'verify post-merge ancestry' "
82 test x\`git rev-parse --verify refs/heads/svn\` = \
83 x\`git rev-parse --verify refs/remotes/trunk \` &&
84 test x\`git rev-parse --verify refs/heads/svn^2\` = \
85 x\`git rev-parse --verify refs/heads/merge\` &&
86 git cat-file commit refs/heads/svn^ | grep '^friend$'
89 test_expect_success 'verify merge commit message' "
90 git rev-list --pretty=raw -1 refs/heads/svn | \
91 grep \" Merge branch 'merge' into svn\"
94 test_done