Merge branch 'jk/has-sha1-file-retry-packed'
[alt-git.git] / t / t9140-git-svn-reset.sh
blobe8559046296ce5570ec46b2b3a9280f0a493bbc4
1 #!/bin/sh
3 # Copyright (c) 2009 Ben Jackson
6 test_description='git svn reset'
7 . ./lib-git-svn.sh
9 test_expect_success 'setup test repository' '
10 svn_cmd co "$svnrepo" s &&
12 cd s &&
13 mkdir vis &&
14 echo always visible > vis/vis.txt &&
15 svn_cmd add vis &&
16 svn_cmd commit -m "create visible files" &&
17 mkdir hid &&
18 echo initially hidden > hid/hid.txt &&
19 svn_cmd add hid &&
20 svn_cmd commit -m "create initially hidden files" &&
21 svn_cmd up &&
22 echo mod >> vis/vis.txt &&
23 svn_cmd commit -m "modify vis" &&
24 svn_cmd up
28 test_expect_success 'clone SVN repository with hidden directory' '
29 git svn init "$svnrepo" g &&
30 ( cd g && git svn fetch --ignore-paths="^hid" )
33 test_expect_success 'modify hidden file in SVN repo' '
34 ( cd s &&
35 echo mod hidden >> hid/hid.txt &&
36 svn_cmd commit -m "modify hid" &&
37 svn_cmd up
41 test_expect_success 'fetch fails on modified hidden file' '
42 ( cd g &&
43 git svn find-rev refs/remotes/git-svn > ../expect &&
44 test_must_fail git svn fetch 2> ../errors &&
45 git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
46 fgrep "not found in commit" errors &&
47 test_cmp expect expect2
50 test_expect_success 'reset unwinds back to r1' '
51 ( cd g &&
52 git svn reset -r1 &&
53 git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
54 echo 1 >expect &&
55 test_cmp expect expect2
58 test_expect_success 'refetch succeeds not ignoring any files' '
59 ( cd g &&
60 git svn fetch &&
61 git svn rebase &&
62 fgrep "mod hidden" hid/hid.txt
66 test_done