]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9108-git-svn-glob.sh
Merge branch 'bc/sha-256-cvs-svn-updates'
[thirdparty/git.git] / t / t9108-git-svn-glob.sh
CommitLineData
74a81227
EW
1#!/bin/sh
2# Copyright (c) 2007 Eric Wong
1364ff27 3test_description='git svn globbing refspecs'
74a81227
EW
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 &&
da083d68
ER
17 svn_cmd import -m "initial" trunk "$svnrepo"/trunk &&
18 svn_cmd co "$svnrepo" tmp &&
b47ddefe
MG
19 (
20 cd tmp &&
74a81227 21 mkdir branches tags &&
da083d68
ER
22 svn_cmd add branches tags &&
23 svn_cmd cp trunk branches/start &&
24 svn_cmd commit -m "start a new branch" &&
25 svn_cmd up &&
f69e836f 26 echo "hi" >> branches/start/src/b/readme &&
ccb6b6f5 27 poke branches/start/src/b/readme &&
f69e836f 28 echo "hey" >> branches/start/src/a/readme &&
ccb6b6f5 29 poke branches/start/src/a/readme &&
da083d68
ER
30 svn_cmd commit -m "hi" &&
31 svn_cmd up &&
32 svn_cmd cp branches/start tags/end &&
f69e836f 33 echo "bye" >> tags/end/src/b/readme &&
ccb6b6f5 34 poke tags/end/src/b/readme &&
f69e836f 35 echo "aye" >> tags/end/src/a/readme &&
ccb6b6f5 36 poke tags/end/src/a/readme &&
da083d68 37 svn_cmd commit -m "the end" &&
f69e836f 38 echo "byebye" >> tags/end/src/b/readme &&
ccb6b6f5 39 poke tags/end/src/b/readme &&
da083d68 40 svn_cmd commit -m "nothing to see here"
b47ddefe 41 ) &&
f69e836f 42 git config --add svn-remote.svn.url "$svnrepo" &&
74a81227 43 git config --add svn-remote.svn.fetch \
f69e836f 44 "trunk/src/a:refs/remotes/trunk" &&
74a81227 45 git config --add svn-remote.svn.branches \
f69e836f 46 "branches/*/src/a:refs/remotes/branches/*" &&
74a81227 47 git config --add svn-remote.svn.tags\
f69e836f 48 "tags/*/src/a:refs/remotes/tags/*" &&
1364ff27 49 git svn multi-fetch &&
a4d4e32a 50 git log --pretty=oneline refs/remotes/tags/end >actual &&
606b9749 51 cut -d" " -f2- actual >output.end &&
b47ddefe 52 test_cmp expect.end output.end &&
38e94766
EP
53 test "$(git rev-parse refs/remotes/tags/end~1)" = \
54 "$(git rev-parse refs/remotes/branches/start)" &&
55 test "$(git rev-parse refs/remotes/branches/start~2)" = \
56 "$(git rev-parse refs/remotes/trunk)" &&
570d35c2 57 test_must_fail git rev-parse refs/remotes/tags/end@3
f69e836f 58 '
74a81227 59
28710f74
EW
60echo try to try > expect.two
61echo nothing to see here >> expect.two
62cat expect.end >> expect.two
63
f69e836f
BD
64test_expect_success 'test left-hand-side only globbing' '
65 git config --add svn-remote.two.url "$svnrepo" &&
28710f74
EW
66 git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
67 git config --add svn-remote.two.branches \
f69e836f 68 "branches/*:refs/remotes/two/branches/*" &&
28710f74 69 git config --add svn-remote.two.tags \
f69e836f 70 "tags/*:refs/remotes/two/tags/*" &&
b47ddefe
MG
71 (
72 cd tmp &&
f69e836f 73 echo "try try" >> tags/end/src/b/readme &&
28710f74 74 poke tags/end/src/b/readme &&
da083d68 75 svn_cmd commit -m "try to try"
b47ddefe 76 ) &&
1364ff27 77 git svn fetch two &&
a4d4e32a
PK
78 git rev-list refs/remotes/two/tags/end >actual &&
79 test_line_count = 6 actual &&
80 git rev-list refs/remotes/two/branches/start >actual &&
81 test_line_count = 3 actual &&
38e94766
EP
82 test $(git rev-parse refs/remotes/two/branches/start~2) = \
83 $(git rev-parse refs/remotes/two/trunk) &&
84 test $(git rev-parse refs/remotes/two/tags/end~3) = \
85 $(git rev-parse refs/remotes/two/branches/start) &&
a4d4e32a 86 git log --pretty=oneline refs/remotes/two/tags/end >actual &&
606b9749 87 cut -d" " -f2- actual >output.two &&
b47ddefe
MG
88 test_cmp expect.two output.two
89 '
90
62335bbb
EW
91test_expect_success 'prepare test disallow multi-globs' "
92cat >expect.three <<EOF
93Only one set of wildcards (e.g. '*' or '*/*/*') is supported: branches/*/t/*
94
95EOF
96 "
b47ddefe
MG
97
98test_expect_success 'test disallow multi-globs' '
99 git config --add svn-remote.three.url "$svnrepo" &&
100 git config --add svn-remote.three.fetch \
101 trunk:refs/remotes/three/trunk &&
102 git config --add svn-remote.three.branches \
570d35c2 103 "branches/*/t/*:refs/remotes/three/branches/*" &&
b47ddefe
MG
104 git config --add svn-remote.three.tags \
105 "tags/*/*:refs/remotes/three/tags/*" &&
106 (
107 cd tmp &&
108 echo "try try" >> tags/end/src/b/readme &&
109 poke tags/end/src/b/readme &&
da083d68 110 svn_cmd commit -m "try to try"
b47ddefe 111 ) &&
1364ff27 112 test_must_fail git svn fetch three 2> stderr.three &&
b47ddefe 113 test_cmp expect.three stderr.three
f69e836f 114 '
28710f74 115
74a81227 116test_done