]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9108-git-svn-glob.sh
git-commit.txt: Add missing long/short options
[thirdparty/git.git] / t / t9108-git-svn-glob.sh
CommitLineData
74a81227
EW
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
f69e836f 13test_expect_success 'test refspec globbing' '
74a81227 14 mkdir -p trunk/src/a trunk/src/b trunk/doc &&
f69e836f
BD
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 &&
74a81227
EW
19 cd tmp &&
20 mkdir branches tags &&
21 svn add branches tags &&
22 svn cp trunk branches/start &&
f69e836f 23 svn commit -m "start a new branch" &&
74a81227 24 svn up &&
f69e836f 25 echo "hi" >> branches/start/src/b/readme &&
ccb6b6f5 26 poke branches/start/src/b/readme &&
f69e836f 27 echo "hey" >> branches/start/src/a/readme &&
ccb6b6f5 28 poke branches/start/src/a/readme &&
f69e836f 29 svn commit -m "hi" &&
74a81227
EW
30 svn up &&
31 svn cp branches/start tags/end &&
f69e836f 32 echo "bye" >> tags/end/src/b/readme &&
ccb6b6f5 33 poke tags/end/src/b/readme &&
f69e836f 34 echo "aye" >> tags/end/src/a/readme &&
ccb6b6f5 35 poke tags/end/src/a/readme &&
f69e836f
BD
36 svn commit -m "the end" &&
37 echo "byebye" >> tags/end/src/b/readme &&
ccb6b6f5 38 poke tags/end/src/b/readme &&
f69e836f 39 svn commit -m "nothing to see here"
74a81227 40 cd .. &&
f69e836f 41 git config --add svn-remote.svn.url "$svnrepo" &&
74a81227 42 git config --add svn-remote.svn.fetch \
f69e836f 43 "trunk/src/a:refs/remotes/trunk" &&
74a81227 44 git config --add svn-remote.svn.branches \
f69e836f 45 "branches/*/src/a:refs/remotes/branches/*" &&
74a81227 46 git config --add svn-remote.svn.tags\
f69e836f 47 "tags/*/src/a:refs/remotes/tags/*" &&
74a81227
EW
48 git-svn multi-fetch &&
49 git log --pretty=oneline refs/remotes/tags/end | \
f69e836f 50 sed -e "s/^.\{41\}//" > output.end &&
74a81227 51 cmp expect.end output.end &&
f69e836f
BD
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 '
74a81227 57
28710f74
EW
58echo try to try > expect.two
59echo nothing to see here >> expect.two
60cat expect.end >> expect.two
61
f69e836f
BD
62test_expect_success 'test left-hand-side only globbing' '
63 git config --add svn-remote.two.url "$svnrepo" &&
28710f74
EW
64 git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
65 git config --add svn-remote.two.branches \
f69e836f 66 "branches/*:refs/remotes/two/branches/*" &&
28710f74 67 git config --add svn-remote.two.tags \
f69e836f 68 "tags/*:refs/remotes/two/tags/*" &&
28710f74 69 cd tmp &&
f69e836f 70 echo "try try" >> tags/end/src/b/readme &&
28710f74 71 poke tags/end/src/b/readme &&
f69e836f 72 svn commit -m "try to try"
28710f74
EW
73 cd .. &&
74 git-svn fetch two &&
f69e836f
BD
75 test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
76 test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 &&
77 test `git rev-parse refs/remotes/two/branches/start~2` = \
78 `git rev-parse refs/remotes/two/trunk` &&
79 test `git rev-parse refs/remotes/two/tags/end~3` = \
80 `git rev-parse refs/remotes/two/branches/start` &&
28710f74 81 git log --pretty=oneline refs/remotes/two/tags/end | \
f69e836f 82 sed -e "s/^.\{41\}//" > output.two &&
28710f74 83 cmp expect.two output.two
f69e836f 84 '
28710f74 85
74a81227 86test_done