Merge pull request #285 from dscho/readme
[git/mingw/4msysgit.git] / t / t9163-git-svn-reset-clears-caches.sh
blobd6245cee081059d98e72758a3ff7bb42730a7662
1 #!/bin/sh
3 # Copyright (c) 2012 Peter Baumann
6 test_description='git svn reset clears memoized caches'
7 . ./lib-git-svn.sh
9 svn_ver="$(svn --version --quiet)"
10 case $svn_ver in
11 0.* | 1.[0-4].*)
12 skip_all="skipping git-svn test - SVN too old ($svn_ver)"
13 test_done
15 esac
17 # ... a - b - m <- trunk
18 # \ /
19 # ... c <- branch1
21 # SVN Commits not interesting for this test are abbreviated with "..."
23 test_expect_success 'initialize source svn repo' '
24 svn_cmd mkdir -m "create trunk" "$svnrepo"/trunk &&
25 svn_cmd mkdir -m "create branches" "$svnrepo/branches" &&
26 svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
28 cd "$SVN_TREE" &&
29 touch foo &&
30 svn_cmd add foo &&
31 svn_cmd commit -m "a" &&
32 svn_cmd cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
33 svn_cmd switch "$svnrepo"/branches/branch1 &&
34 touch bar &&
35 svn_cmd add bar &&
36 svn_cmd commit -m b &&
37 svn_cmd switch "$svnrepo"/trunk &&
38 touch baz &&
39 svn_cmd add baz &&
40 svn_cmd commit -m c &&
41 svn_cmd up &&
42 svn_cmd merge "$svnrepo"/branches/branch1 &&
43 svn_cmd commit -m "m"
44 ) &&
45 rm -rf "$SVN_TREE"
48 test_expect_success 'fetch to merge-base (a)' '
49 git svn init -s "$svnrepo" &&
50 git svn fetch --revision BASE:3
53 # git svn rebase looses the merge commit
55 # ... a - b - m <- trunk
56 # \
57 # ... c
59 test_expect_success 'rebase looses SVN merge (m)' '
60 git svn rebase &&
61 git svn fetch &&
62 test 1 = $(git cat-file -p master|grep parent|wc -l)
65 # git svn fetch creates correct history with merge commit
67 # ... a - b - m <- trunk
68 # \ /
69 # ... c <- branch1
71 test_expect_success 'reset and fetch gets the SVN merge (m) correctly' '
72 git svn reset -r 3 &&
73 git reset --hard origin/trunk &&
74 git svn fetch &&
75 test 2 = $(git cat-file -p origin/trunk|grep parent|wc -l)
78 test_done