blob: 41a026637fa03174765d4e3facc3815bbf538e29 [file] [log] [blame]
Eric Wongcfbe7ab2007-11-11 23:37:42 -08001#!/bin/sh
2#
3# Copyright (c) 2007 Eric Wong
4#
5
Nanako Shiraishi1364ff22008-09-08 19:02:08 +09006test_description='git svn funky branch names'
Eric Wongcfbe7ab2007-11-11 23:37:42 -08007. ./lib-git-svn.sh
8
Eric Wongf4392df2008-09-06 20:18:18 -07009# Abo-Uebernahme (Bug #994)
10scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29'
11scary_ref='Abo-Uebernahme%20(Bug%20#994)'
12
Bryan Donlanf69e8362008-05-04 01:37:59 -040013test_expect_success 'setup svnrepo' '
Eric Wongcfbe7ab2007-11-11 23:37:42 -080014 mkdir project project/trunk project/branches project/tags &&
15 echo foo > project/trunk/foo &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040016 svn_cmd import -m "$test_description" project "$svnrepo/pr ject" &&
Eric Wongcfbe7ab2007-11-11 23:37:42 -080017 rm -rf project &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040018 svn_cmd cp -m "fun" "$svnrepo/pr ject/trunk" \
Bryan Donlanf69e8362008-05-04 01:37:59 -040019 "$svnrepo/pr ject/branches/fun plugin" &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040020 svn_cmd cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
Bryan Donlanf69e8362008-05-04 01:37:59 -040021 "$svnrepo/pr ject/branches/more fun plugin!" &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040022 svn_cmd cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \
Eric Wongf4392df2008-09-06 20:18:18 -070023 "$svnrepo/pr ject/branches/$scary_uri" &&
Torsten Schmutzler73d41952010-05-06 22:20:43 +020024 svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
25 "$svnrepo/pr ject/branches/.leading_dot" &&
Johannes Schindelin75e005e2016-01-27 17:20:11 +010026 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 Schmutzler73d41952010-05-06 22:20:43 +020031 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 Nieder44bc5ac2012-10-09 01:41:45 -070034 "$svnrepo/pr ject/branches/not-a@{0}reflog@" &&
Eric Wonga8a5d252016-07-23 04:26:08 +000035 maybe_start_httpd
Bryan Donlanf69e8362008-05-04 01:37:59 -040036 '
Eric Wongcfbe7ab2007-11-11 23:37:42 -080037
Michael G. Schwerndad90902012-07-28 02:47:45 -070038# 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 Pinto1d9e86f2016-01-12 10:45:18 +000041non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/')
Michael G. Schwerndad90902012-07-28 02:47:45 -070042
Bryan Donlanf69e8362008-05-04 01:37:59 -040043test_expect_success 'test clone with funky branch names' '
44 git svn clone -s "$svnrepo/pr ject" project &&
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050045 (
46 cd project &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020047 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 Schindelin75e005e2016-01-27 17:20:11 +010051 if test_have_prereq !MINGW
52 then
53 git rev-parse "refs/remotes/origin/trailing_dot%2E"
54 fi &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020055 git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
56 git rev-parse "refs/remotes/origin/$non_reflog"
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050057 )
Bryan Donlanf69e8362008-05-04 01:37:59 -040058 '
Eric Wongcfbe7ab2007-11-11 23:37:42 -080059
60test_expect_success 'test dcommit to funky branch' "
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050061 (
62 cd project &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020063 git reset --hard 'refs/remotes/origin/more%20fun%20plugin!' &&
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050064 echo hello >> foo &&
65 git commit -m 'hello' -- foo &&
66 git svn dcommit
67 )
Eric Wongcfbe7ab2007-11-11 23:37:42 -080068 "
69
Eric Wongf4392df2008-09-06 20:18:18 -070070test_expect_success 'test dcommit to scary branch' '
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050071 (
72 cd project &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020073 git reset --hard "refs/remotes/origin/$scary_ref" &&
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050074 echo urls are scary >> foo &&
75 git commit -m "eep" -- foo &&
76 git svn dcommit
77 )
Eric Wongf4392df2008-09-06 20:18:18 -070078 '
79
Torsten Schmutzler73d41952010-05-06 22:20:43 +020080test_expect_success 'test dcommit to trailing_dotlock branch' '
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050081 (
82 cd project &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020083 git reset --hard "refs/remotes/origin/trailing_dotlock%2Elock" &&
Jonathan Nieder4ecb7932010-07-08 08:36:02 -050084 echo who names branches like this anyway? >> foo &&
85 git commit -m "bar" -- foo &&
86 git svn dcommit
87 )
Torsten Schmutzler73d41952010-05-06 22:20:43 +020088 '
89
Eric Wongcfbe7ab2007-11-11 23:37:42 -080090stop_httpd
91
92test_done