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 echo 'hey' >> branches/start/src/a/readme &&
27 svn commit -m 'hi' &&
28 svn up &&
29 svn cp branches/start tags/end &&
30 echo 'bye' >> tags/end/src/b/readme &&
31 echo 'aye' >> tags/end/src/a/readme &&
32 svn commit -m 'the end' &&
33 echo 'byebye' >> tags/end/src/b/readme &&
34 svn commit -m 'nothing to see here'
35 cd .. &&
36 git config --add svn-remote.svn.url $svnrepo &&
37 git config --add svn-remote.svn.fetch \
38 'trunk/src/a:refs/remotes/trunk' &&
39 git config --add svn-remote.svn.branches \
40 'branches/*/src/a:refs/remotes/branches/*' &&
41 git config --add svn-remote.svn.tags\
42 'tags/*/src/a:refs/remotes/tags/*' &&
43 git-svn multi-fetch &&
44 git log --pretty=oneline refs/remotes/tags/end | \
45 sed -e 's/^.\{41\}//' > output.end &&
46 cmp expect.end output.end &&
47 test \"\`git rev-parse refs/remotes/tags/end~1\`\" = \
48 \"\`git rev-parse refs/remotes/branches/start\`\" &&
49 test \"\`git rev-parse refs/remotes/branches/start~2\`\" = \
50 \"\`git rev-parse refs/remotes/trunk\`\"
51 "
52
53test_done