t / t9118-git-svn-funky-branch-names.shon commit Merge branch 'cc/first-contrib-tutorial' (3e6c6b7)
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Eric Wong
   4#
   5
   6test_description='git svn funky branch names'
   7. ./lib-git-svn.sh
   8
   9# Abo-Uebernahme (Bug #994)
  10scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29'
  11scary_ref='Abo-Uebernahme%20(Bug%20#994)'
  12
  13test_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        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 &&
  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" \
  34                        "$svnrepo/pr ject/branches/not-a@{0}reflog@" &&
  35        maybe_start_httpd
  36        '
  37
  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.
  41non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/')
  42
  43test_expect_success 'test clone with funky branch names' '
  44        git svn clone -s "$svnrepo/pr ject" project &&
  45        (
  46                cd project &&
  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" &&
  51                if test_have_prereq !MINGW
  52                then
  53                        git rev-parse "refs/remotes/origin/trailing_dot%2E"
  54                fi &&
  55                git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
  56                git rev-parse "refs/remotes/origin/$non_reflog"
  57        )
  58        '
  59
  60test_expect_success 'test dcommit to funky branch' "
  61        (
  62                cd project &&
  63                git reset --hard 'refs/remotes/origin/more%20fun%20plugin!' &&
  64                echo hello >> foo &&
  65                git commit -m 'hello' -- foo &&
  66                git svn dcommit
  67        )
  68        "
  69
  70test_expect_success 'test dcommit to scary branch' '
  71        (
  72                cd project &&
  73                git reset --hard "refs/remotes/origin/$scary_ref" &&
  74                echo urls are scary >> foo &&
  75                git commit -m "eep" -- foo &&
  76                git svn dcommit
  77        )
  78        '
  79
  80test_expect_success 'test dcommit to trailing_dotlock branch' '
  81        (
  82                cd project &&
  83                git reset --hard "refs/remotes/origin/trailing_dotlock%2Elock" &&
  84                echo who names branches like this anyway? >> foo &&
  85                git commit -m "bar" -- foo &&
  86                git svn dcommit
  87        )
  88        '
  89
  90test_done