Merge branch 'jn/warn-on-inaccessible-loosen'
[git] / t / t9118-git-svn-funky-branch-names.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Eric Wong
4 #
5
6 test_description='git svn funky branch names'
7 . ./lib-git-svn.sh
8
9 # Abo-Uebernahme (Bug #994)
10 scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29'
11 scary_ref='Abo-Uebernahme%20(Bug%20#994)'
12
13 test_expect_success 'setup svnrepo' '
14         mkdir project project/trunk project/branches project/tags &&
15         echo foo > project/trunk/foo &&
16         svn_cmd import -m "$test_description" project "$svnrepo/pr ject" &&
17         rm -rf project &&
18         svn_cmd cp -m "fun" "$svnrepo/pr ject/trunk" \
19                         "$svnrepo/pr ject/branches/fun plugin" &&
20         svn_cmd cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
21                               "$svnrepo/pr ject/branches/more fun plugin!" &&
22         svn_cmd cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \
23                       "$svnrepo/pr ject/branches/$scary_uri" &&
24         svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
25                         "$svnrepo/pr ject/branches/.leading_dot" &&
26         svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
27                         "$svnrepo/pr ject/branches/trailing_dot." &&
28         svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
29                         "$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
30         svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
31                         "$svnrepo/pr ject/branches/not-a@{0}reflog@" &&
32         start_httpd
33         '
34
35 # SVN 1.7 will truncate "not-a%40{0]" to just "not-a".
36 # Look at what SVN wound up naming the branch and use that.
37 # Be sure to escape the @ if it shows up.
38 non_reflog=`svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/'`
39
40 test_expect_success 'test clone with funky branch names' '
41         git svn clone -s "$svnrepo/pr ject" project &&
42         (
43                 cd project &&
44                 git rev-parse "refs/remotes/fun%20plugin" &&
45                 git rev-parse "refs/remotes/more%20fun%20plugin!" &&
46                 git rev-parse "refs/remotes/$scary_ref" &&
47                 git rev-parse "refs/remotes/%2Eleading_dot" &&
48                 git rev-parse "refs/remotes/trailing_dot%2E" &&
49                 git rev-parse "refs/remotes/trailing_dotlock%2Elock" &&
50                 git rev-parse "refs/remotes/$non_reflog"
51         )
52         '
53
54 test_expect_success 'test dcommit to funky branch' "
55         (
56                 cd project &&
57                 git reset --hard 'refs/remotes/more%20fun%20plugin!' &&
58                 echo hello >> foo &&
59                 git commit -m 'hello' -- foo &&
60                 git svn dcommit
61         )
62         "
63
64 test_expect_success 'test dcommit to scary branch' '
65         (
66                 cd project &&
67                 git reset --hard "refs/remotes/$scary_ref" &&
68                 echo urls are scary >> foo &&
69                 git commit -m "eep" -- foo &&
70                 git svn dcommit
71         )
72         '
73
74 test_expect_success 'test dcommit to trailing_dotlock branch' '
75         (
76                 cd project &&
77                 git reset --hard "refs/remotes/trailing_dotlock%2Elock" &&
78                 echo who names branches like this anyway? >> foo &&
79                 git commit -m "bar" -- foo &&
80                 git svn dcommit
81         )
82         '
83
84 stop_httpd
85
86 test_done