1#!/bin/sh
2# Copyright (c) 2007 Eric Wong
3test_description='git-svn globbing refspecs'
4. ./lib-git-svn.sh
5
6cat > expect.end <<EOF
7the end
8hi
9start a new branch
10initial
11EOF
12
13test_expect_success 'test refspec globbing' "
14 mkdir -p trunk/src/a trunk/src/b trunk/doc &&
15 echo 'hello world' > trunk/src/a/readme &&
16 echo 'goodbye world' > trunk/src/b/readme &&
17 svn import -m 'initial' trunk $svnrepo/trunk &&
18 svn co $svnrepo tmp &&
19 cd tmp &&
20 mkdir branches tags &&
21 svn add branches tags &&
22 svn cp trunk branches/start &&
23 svn commit -m 'start a new branch' &&
24 svn up &&
25 echo 'hi' >> branches/start/src/b/readme &&
26 poke branches/start/src/b/readme &&
27 echo 'hey' >> branches/start/src/a/readme &&
28 poke branches/start/src/a/readme &&
29 svn commit -m 'hi' &&
30 svn up &&
31 svn cp branches/start tags/end &&
32 echo 'bye' >> tags/end/src/b/readme &&
33 poke tags/end/src/b/readme &&
34 echo 'aye' >> tags/end/src/a/readme &&
35 poke tags/end/src/a/readme &&
36 svn commit -m 'the end' &&
37 echo 'byebye' >> tags/end/src/b/readme &&
38 poke tags/end/src/b/readme &&
39 svn commit -m 'nothing to see here'
40 cd .. &&
41 git config --add svn-remote.svn.url $svnrepo &&
42 git config --add svn-remote.svn.fetch \
43 'trunk/src/a:refs/remotes/trunk' &&
44 git config --add svn-remote.svn.branches \
45 'branches/*/src/a:refs/remotes/branches/*' &&
46 git config --add svn-remote.svn.tags\
47 'tags/*/src/a:refs/remotes/tags/*' &&
48 git-svn multi-fetch &&
49 git log --pretty=oneline refs/remotes/tags/end | \
50 sed -e 's/^.\{41\}//' > output.end &&
51 cmp expect.end output.end &&
52 test \"\`git rev-parse refs/remotes/tags/end~1\`\" = \
53 \"\`git rev-parse refs/remotes/branches/start\`\" &&
54 test \"\`git rev-parse refs/remotes/branches/start~2\`\" = \
55 \"\`git rev-parse refs/remotes/trunk\`\"
56 "
57
58test_done