t9143-git-svn-gc.sh 1.38 KB
Newer Older
Robert Allan Zeh's avatar
Robert Allan Zeh committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/sh
#
# Copyright (c) 2009 Robert Allan Zeh

test_description='git svn gc basic tests'

. ./lib-git-svn.sh

test_expect_success 'setup directories and test repo' '
	mkdir import &&
	mkdir tmp &&
	echo "Sample text for Subversion repository." > import/test.txt &&
	svn_cmd import -m "import for git svn" import "$svnrepo" > /dev/null
	'

test_expect_success 'checkout working copy from svn' \
	'svn_cmd co "$svnrepo" test_wc'

test_expect_success 'set some properties to create an unhandled.log file' '
	(
		cd test_wc &&
		svn_cmd propset foo bar test.txt &&
		svn_cmd commit -m "property set"
	)'

test_expect_success 'Setup repo' 'git svn init "$svnrepo"'

test_expect_success 'Fetch repo' 'git svn fetch'

test_expect_success 'make backup copy of unhandled.log' '
31
	 cp .git/svn/refs/remotes/git-svn/unhandled.log tmp
Robert Allan Zeh's avatar
Robert Allan Zeh committed
32 33
	'

34
test_expect_success 'create leftover index' '> .git/svn/refs/remotes/git-svn/index'
35

Robert Allan Zeh's avatar
Robert Allan Zeh committed
36 37
test_expect_success 'git svn gc runs' 'git svn gc'

38
test_expect_success 'git svn index removed' '! test -f .git/svn/refs/remotes/git-svn/index'
39

40
if test -r .git/svn/refs/remotes/git-svn/unhandled.log.gz
41 42
then
	test_expect_success 'git svn gc produces a valid gzip file' '
43
		 gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz
44 45
		'
fi
Robert Allan Zeh's avatar
Robert Allan Zeh committed
46 47

test_expect_success 'git svn gc does not change unhandled.log files' '
48
	 test_cmp .git/svn/refs/remotes/git-svn/unhandled.log tmp/unhandled.log
Robert Allan Zeh's avatar
Robert Allan Zeh committed
49 50 51
	'

test_done