Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Eric Wong |
| 4 | # |
| 5 | |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 6 | test_description='git svn funky branch names' |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 7 | . ./lib-git-svn.sh |
| 8 | |
Eric Wong | f4392df | 2008-09-06 20:18:18 -0700 | [diff] [blame] | 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 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 13 | test_expect_success 'setup svnrepo' ' |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 14 | mkdir project project/trunk project/branches project/tags && |
| 15 | echo foo > project/trunk/foo && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 16 | svn_cmd import -m "$test_description" project "$svnrepo/pr ject" && |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 17 | rm -rf project && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 18 | svn_cmd cp -m "fun" "$svnrepo/pr ject/trunk" \ |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 19 | "$svnrepo/pr ject/branches/fun plugin" && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 20 | svn_cmd cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \ |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 21 | "$svnrepo/pr ject/branches/more fun plugin!" && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 22 | svn_cmd cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \ |
Eric Wong | f4392df | 2008-09-06 20:18:18 -0700 | [diff] [blame] | 23 | "$svnrepo/pr ject/branches/$scary_uri" && |
Torsten Schmutzler | 73d4195 | 2010-05-06 22:20:43 +0200 | [diff] [blame] | 24 | svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \ |
| 25 | "$svnrepo/pr ject/branches/.leading_dot" && |
Johannes Schindelin | 75e005e | 2016-01-27 17:20:11 +0100 | [diff] [blame] | 26 | if test_have_prereq !MINGW |
| 27 | then |
| 28 | svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \ |
| 29 | "$svnrepo/pr ject/branches/trailing_dot." |
| 30 | fi && |
Torsten Schmutzler | 73d4195 | 2010-05-06 22:20:43 +0200 | [diff] [blame] | 31 | svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \ |
| 32 | "$svnrepo/pr ject/branches/trailing_dotlock.lock" && |
| 33 | svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \ |
Jonathan Nieder | 44bc5ac | 2012-10-09 01:41:45 -0700 | [diff] [blame] | 34 | "$svnrepo/pr ject/branches/not-a@{0}reflog@" && |
Eric Wong | a8a5d25 | 2016-07-23 04:26:08 +0000 | [diff] [blame] | 35 | maybe_start_httpd |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 36 | ' |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 37 | |
Michael G. Schwern | dad9090 | 2012-07-28 02:47:45 -0700 | [diff] [blame] | 38 | # SVN 1.7 will truncate "not-a%40{0]" to just "not-a". |
| 39 | # Look at what SVN wound up naming the branch and use that. |
| 40 | # Be sure to escape the @ if it shows up. |
Elia Pinto | 1d9e86f | 2016-01-12 10:45:18 +0000 | [diff] [blame] | 41 | non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/') |
Michael G. Schwern | dad9090 | 2012-07-28 02:47:45 -0700 | [diff] [blame] | 42 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 43 | test_expect_success 'test clone with funky branch names' ' |
| 44 | git svn clone -s "$svnrepo/pr ject" project && |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 45 | ( |
| 46 | cd project && |
Johan Herland | fe191fc | 2013-10-11 14:57:07 +0200 | [diff] [blame] | 47 | git rev-parse "refs/remotes/origin/fun%20plugin" && |
| 48 | git rev-parse "refs/remotes/origin/more%20fun%20plugin!" && |
| 49 | git rev-parse "refs/remotes/origin/$scary_ref" && |
| 50 | git rev-parse "refs/remotes/origin/%2Eleading_dot" && |
Johannes Schindelin | 75e005e | 2016-01-27 17:20:11 +0100 | [diff] [blame] | 51 | if test_have_prereq !MINGW |
| 52 | then |
| 53 | git rev-parse "refs/remotes/origin/trailing_dot%2E" |
| 54 | fi && |
Johan Herland | fe191fc | 2013-10-11 14:57:07 +0200 | [diff] [blame] | 55 | git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" && |
| 56 | git rev-parse "refs/remotes/origin/$non_reflog" |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 57 | ) |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 58 | ' |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 59 | |
| 60 | test_expect_success 'test dcommit to funky branch' " |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 61 | ( |
| 62 | cd project && |
Johan Herland | fe191fc | 2013-10-11 14:57:07 +0200 | [diff] [blame] | 63 | git reset --hard 'refs/remotes/origin/more%20fun%20plugin!' && |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 64 | echo hello >> foo && |
| 65 | git commit -m 'hello' -- foo && |
| 66 | git svn dcommit |
| 67 | ) |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 68 | " |
| 69 | |
Eric Wong | f4392df | 2008-09-06 20:18:18 -0700 | [diff] [blame] | 70 | test_expect_success 'test dcommit to scary branch' ' |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 71 | ( |
| 72 | cd project && |
Johan Herland | fe191fc | 2013-10-11 14:57:07 +0200 | [diff] [blame] | 73 | git reset --hard "refs/remotes/origin/$scary_ref" && |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 74 | echo urls are scary >> foo && |
| 75 | git commit -m "eep" -- foo && |
| 76 | git svn dcommit |
| 77 | ) |
Eric Wong | f4392df | 2008-09-06 20:18:18 -0700 | [diff] [blame] | 78 | ' |
| 79 | |
Torsten Schmutzler | 73d4195 | 2010-05-06 22:20:43 +0200 | [diff] [blame] | 80 | test_expect_success 'test dcommit to trailing_dotlock branch' ' |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 81 | ( |
| 82 | cd project && |
Johan Herland | fe191fc | 2013-10-11 14:57:07 +0200 | [diff] [blame] | 83 | git reset --hard "refs/remotes/origin/trailing_dotlock%2Elock" && |
Jonathan Nieder | 4ecb793 | 2010-07-08 08:36:02 -0500 | [diff] [blame] | 84 | echo who names branches like this anyway? >> foo && |
| 85 | git commit -m "bar" -- foo && |
| 86 | git svn dcommit |
| 87 | ) |
Torsten Schmutzler | 73d4195 | 2010-05-06 22:20:43 +0200 | [diff] [blame] | 88 | ' |
| 89 | |
Eric Wong | cfbe7ab | 2007-11-11 23:37:42 -0800 | [diff] [blame] | 90 | stop_httpd |
| 91 | |
| 92 | test_done |