blob: b7ef9e25895550e8749952e2ed54d7827737242e [file] [log] [blame]
Eric Wong41337e22007-11-17 12:47:16 -08001#!/bin/sh
2#
3# Copyright (c) 2007 Eric Wong
4#
5
Nanako Shiraishi1364ff22008-09-08 19:02:08 +09006test_description='git svn init/clone tests'
Eric Wong41337e22007-11-17 12:47:16 -08007
8. ./lib-git-svn.sh
9
10# setup, run inside tmp so we don't have any conflicts with $svnrepo
11set -e
12rm -r .git
13mkdir tmp
14cd tmp
15
Bryan Donlanf69e8362008-05-04 01:37:59 -040016test_expect_success 'setup svnrepo' '
Eric Wong41337e22007-11-17 12:47:16 -080017 mkdir project project/trunk project/branches project/tags &&
18 echo foo > project/trunk/foo &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040019 svn_cmd import -m "$test_description" project "$svnrepo"/project &&
Eric Wong41337e22007-11-17 12:47:16 -080020 rm -rf project
Bryan Donlanf69e8362008-05-04 01:37:59 -040021 '
Eric Wong41337e22007-11-17 12:47:16 -080022
Bryan Donlanf69e8362008-05-04 01:37:59 -040023test_expect_success 'basic clone' '
Eric Wong41337e22007-11-17 12:47:16 -080024 test ! -d trunk &&
Bryan Donlanf69e8362008-05-04 01:37:59 -040025 git svn clone "$svnrepo"/project/trunk &&
Eric Wong41337e22007-11-17 12:47:16 -080026 test -d trunk/.git/svn &&
27 test -e trunk/foo &&
28 rm -rf trunk
Bryan Donlanf69e8362008-05-04 01:37:59 -040029 '
Eric Wong41337e22007-11-17 12:47:16 -080030
Bryan Donlanf69e8362008-05-04 01:37:59 -040031test_expect_success 'clone to target directory' '
Eric Wong41337e22007-11-17 12:47:16 -080032 test ! -d target &&
Bryan Donlanf69e8362008-05-04 01:37:59 -040033 git svn clone "$svnrepo"/project/trunk target &&
Eric Wong41337e22007-11-17 12:47:16 -080034 test -d target/.git/svn &&
35 test -e target/foo &&
36 rm -rf target
Bryan Donlanf69e8362008-05-04 01:37:59 -040037 '
Eric Wong41337e22007-11-17 12:47:16 -080038
Bryan Donlanf69e8362008-05-04 01:37:59 -040039test_expect_success 'clone with --stdlayout' '
Eric Wong41337e22007-11-17 12:47:16 -080040 test ! -d project &&
Bryan Donlanf69e8362008-05-04 01:37:59 -040041 git svn clone -s "$svnrepo"/project &&
Eric Wong41337e22007-11-17 12:47:16 -080042 test -d project/.git/svn &&
43 test -e project/foo &&
44 rm -rf project
Bryan Donlanf69e8362008-05-04 01:37:59 -040045 '
Eric Wong41337e22007-11-17 12:47:16 -080046
Bryan Donlanf69e8362008-05-04 01:37:59 -040047test_expect_success 'clone to target directory with --stdlayout' '
Eric Wong41337e22007-11-17 12:47:16 -080048 test ! -d target &&
Bryan Donlanf69e8362008-05-04 01:37:59 -040049 git svn clone -s "$svnrepo"/project target &&
Eric Wong41337e22007-11-17 12:47:16 -080050 test -d target/.git/svn &&
51 test -e target/foo &&
52 rm -rf target
Bryan Donlanf69e8362008-05-04 01:37:59 -040053 '
Eric Wong41337e22007-11-17 12:47:16 -080054
55test_done