#!/bin/sh # # Copyright (c) 2009 Robert Allan Zeh global test_description := ''git svn gc basic tests'' source ./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' ' cp .git/svn/refs/remotes/git-svn/unhandled.log tmp ' test_expect_success 'create leftover index' '> .git/svn/refs/remotes/git-svn/index' test_expect_success 'git svn gc runs' 'git svn gc' test_expect_success 'git svn index removed' '! test -f .git/svn/refs/remotes/git-svn/index' if test -r .git/svn/refs/remotes/git-svn/unhandled.log.gz { test_expect_success 'git svn gc produces a valid gzip file' ' gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz ' } test_expect_success 'git svn gc does not change unhandled.log files' ' test_cmp .git/svn/refs/remotes/git-svn/unhandled.log tmp/unhandled.log ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git svn gc basic tests">)} spids: [10] ) ] spids: [10] ) (C {(.)} {(./lib-git-svn.sh)}) (C {(test_expect_success)} {(SQ <"setup directories and test repo">)} { (SQ <"\n"> <"\tmkdir import &&\n"> <"\tmkdir tmp &&\n"> <"\techo \"Sample text for Subversion repository.\" > import/test.txt &&\n"> <"\tsvn_cmd import -m \"import for git svn\" import \"$svnrepo\" > /dev/null\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"checkout working copy from svn">)} {(SQ <"svn_cmd co \"$svnrepo\" test_wc">)} ) (C {(test_expect_success)} {(SQ <"set some properties to create an unhandled.log file">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd test_wc &&\n"> <"\t\tsvn_cmd propset foo bar test.txt &&\n"> <"\t\tsvn_cmd commit -m \"property set\"\n"> <"\t)"> ) } ) (C {(test_expect_success)} {(SQ <"Setup repo">)} {(SQ <"git svn init \"$svnrepo\"">)}) (C {(test_expect_success)} {(SQ <"Fetch repo">)} {(SQ <"git svn fetch">)}) (C {(test_expect_success)} {(SQ <"make backup copy of unhandled.log">)} {(SQ <"\n"> <"\t cp .git/svn/refs/remotes/git-svn/unhandled.log tmp\n"> <"\t">)} ) (C {(test_expect_success)} {(SQ <"create leftover index">)} {(SQ <"> .git/svn/refs/remotes/git-svn/index">)} ) (C {(test_expect_success)} {(SQ <"git svn gc runs">)} {(SQ <"git svn gc">)}) (C {(test_expect_success)} {(SQ <"git svn index removed">)} {(SQ <"! test -f .git/svn/refs/remotes/git-svn/index">)} ) (If arms: [ (if_arm cond: [(C {(test)} {(-r)} {(.git/svn/refs/remotes/git-svn/unhandled.log.gz)})] action: [ (C {(test_expect_success)} {(SQ <"git svn gc produces a valid gzip file">)} {(SQ <"\n"> <"\t\t gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz\n"> <"\t\t">)} ) ] spids: [-1 142] ) ] spids: [-1 157] ) (C {(test_expect_success)} {(SQ <"git svn gc does not change unhandled.log files">)} { (SQ <"\n"> <"\t test_cmp .git/svn/refs/remotes/git-svn/unhandled.log tmp/unhandled.log\n"> <"\t"> ) } ) (C {(test_done)}) ] )