Robert Allan Zeh | 2da9ee0 | 2009-07-19 18:00:52 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2009 Robert Allan Zeh |
| 4 | |
| 5 | test_description='git svn gc basic tests' |
| 6 | |
| 7 | . ./lib-git-svn.sh |
| 8 | |
| 9 | test_expect_success 'setup directories and test repo' ' |
| 10 | mkdir import && |
| 11 | mkdir tmp && |
| 12 | echo "Sample text for Subversion repository." > import/test.txt && |
| 13 | svn_cmd import -m "import for git svn" import "$svnrepo" > /dev/null |
| 14 | ' |
| 15 | |
| 16 | test_expect_success 'checkout working copy from svn' \ |
| 17 | 'svn_cmd co "$svnrepo" test_wc' |
| 18 | |
| 19 | test_expect_success 'set some properties to create an unhandled.log file' ' |
| 20 | ( |
| 21 | cd test_wc && |
| 22 | svn_cmd propset foo bar test.txt && |
| 23 | svn_cmd commit -m "property set" |
| 24 | )' |
| 25 | |
| 26 | test_expect_success 'Setup repo' 'git svn init "$svnrepo"' |
| 27 | |
| 28 | test_expect_success 'Fetch repo' 'git svn fetch' |
| 29 | |
| 30 | test_expect_success 'make backup copy of unhandled.log' ' |
Adam Brewster | 6f5748e | 2009-08-11 23:14:27 -0400 | [diff] [blame] | 31 | cp .git/svn/refs/remotes/git-svn/unhandled.log tmp |
Robert Allan Zeh | 2da9ee0 | 2009-07-19 18:00:52 -0500 | [diff] [blame] | 32 | ' |
| 33 | |
Adam Brewster | 6f5748e | 2009-08-11 23:14:27 -0400 | [diff] [blame] | 34 | test_expect_success 'create leftover index' '> .git/svn/refs/remotes/git-svn/index' |
Eric Wong | df73af5 | 2009-07-26 03:01:52 -0700 | [diff] [blame] | 35 | |
Robert Allan Zeh | 2da9ee0 | 2009-07-19 18:00:52 -0500 | [diff] [blame] | 36 | test_expect_success 'git svn gc runs' 'git svn gc' |
| 37 | |
Adam Brewster | 6f5748e | 2009-08-11 23:14:27 -0400 | [diff] [blame] | 38 | test_expect_success 'git svn index removed' '! test -f .git/svn/refs/remotes/git-svn/index' |
Eric Wong | df73af5 | 2009-07-26 03:01:52 -0700 | [diff] [blame] | 39 | |
| 40 | if perl -MCompress::Zlib -e 0 2>/dev/null |
| 41 | then |
| 42 | test_expect_success 'git svn gc produces a valid gzip file' ' |
Adam Brewster | 6f5748e | 2009-08-11 23:14:27 -0400 | [diff] [blame] | 43 | gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz |
Eric Wong | df73af5 | 2009-07-26 03:01:52 -0700 | [diff] [blame] | 44 | ' |
| 45 | else |
| 46 | say "Perl Compress::Zlib unavailable, skipping gunzip test" |
| 47 | fi |
Robert Allan Zeh | 2da9ee0 | 2009-07-19 18:00:52 -0500 | [diff] [blame] | 48 | |
| 49 | test_expect_success 'git svn gc does not change unhandled.log files' ' |
Adam Brewster | 6f5748e | 2009-08-11 23:14:27 -0400 | [diff] [blame] | 50 | test_cmp .git/svn/refs/remotes/git-svn/unhandled.log tmp/unhandled.log |
Robert Allan Zeh | 2da9ee0 | 2009-07-19 18:00:52 -0500 | [diff] [blame] | 51 | ' |
| 52 | |
| 53 | test_done |