#!/bin/sh
# Copyright (c) 2008 Eric Wong

test_description='git-svn submodule'

. ./lib-git-svn.sh

test_expect_success 'setup repo' 'svn co "$svnrepo" svnfoo'

test_expect_success 'add files to svn repo' '
	touch svnfoo/foo.txt
	(cd svnfoo && svn add * && svn commit -m "test commit")
	'

test_expect_success 'git-svn clone the svn repo' '
	git-svn clone "$svnrepo" gitfoo
	'

test_expect_success 'create a git repo to include as a submodule' '
	mkdir git_to_include
	(
		cd git_to_include &&
		git init && 
		echo "This is another file" > another.txt &&
		git add another.txt &&
		git commit -a -m "Adding file to submodule" &&
		git log
	)
	'

test_expect_success 'add the submodule' '
	(
		cd gitfoo &&
		git submodule add "$remove_trash"/git_to_include \
		  git_as_submodule &&
		git commit -a -m "Adding submodule"
	)
	'

test_expect_success 'try to rebase and commit' '
	( cd gitfoo && git svn rebase && git svn dcommit )
	'

test_done
