1test_description='git-svn graft-branches'
2. ./lib-git-svn.sh
3
4svnrepo="$svnrepo/test-git-svn"
5
6test_expect_success 'initialize repo' "
7 mkdir import &&
8 cd import &&
9 mkdir -p trunk branches tags &&
10 echo hello > trunk/readme &&
11 svn import -m 'import for git-svn' . $svnrepo &&
12 cd .. &&
13 svn cp -m 'tag a' $svnrepo/trunk $svnrepo/tags/a &&
14 svn cp -m 'branch a' $svnrepo/trunk $svnrepo/branches/a &&
15 svn co $svnrepo wc &&
16 cd wc &&
17 echo feedme >> branches/a/readme &&
18 svn commit -m hungry &&
19 cd trunk &&
20 svn merge -r3:4 $svnrepo/branches/a &&
21 svn commit -m 'merge with a' &&
22 cd ../.. &&
23 git-svn multi-init $svnrepo -T trunk -b branches -t tags &&
24 git-svn multi-fetch
25 "
26
27r1=`git-rev-list remotes/trunk | tail -n1`
28r2=`git-rev-list remotes/tags/a | tail -n1`
29r3=`git-rev-list remotes/a | tail -n1`
30r4=`git-rev-parse remotes/a`
31r5=`git-rev-parse remotes/trunk`
32
33test_expect_success 'test graft-branches regexes and copies' "
34 test -n "$r1" &&
35 test -n "$r2" &&
36 test -n "$r3" &&
37 test -n "$r4" &&
38 test -n "$r5" &&
39 git-svn graft-branches &&
40 grep '^$r2 $r1' $GIT_DIR/info/grafts &&
41 grep '^$r3 $r1' $GIT_DIR/info/grafts &&
42 grep '^$r5 ' $GIT_DIR/info/grafts | grep '$r4' | grep '$r1'
43 "
44
45test_debug 'gitk --all & sleep 1'
46
47test_expect_success 'test graft-branches with tree-joins' "
48 rm $GIT_DIR/info/grafts &&
49 git-svn graft-branches --no-default-regex --no-graft-copy -B &&
50 grep '^$r3 ' $GIT_DIR/info/grafts | grep '$r1' | grep '$r2' &&
51 grep '^$r2 $r1' $GIT_DIR/info/grafts &&
52 grep '^$r5 ' $GIT_DIR/info/grafts | grep '$r1' | grep '$r4'
53 "
54
55# the result of this is kinda funky, we have a strange history and
56# this is just a test :)
57test_debug 'gitk --all &'
58
59test_done