3 # Copyright (c) 2012 Peter Baumann
6 test_description
='git svn reset clears memoized caches'
7 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
12 svn_ver
="$(svn --version --quiet)"
15 skip_all
="skipping git-svn test - SVN too old ($svn_ver)"
20 # ... a - b - m <- trunk
24 # SVN Commits not interesting for this test are abbreviated with "..."
26 test_expect_success
'initialize source svn repo' '
27 svn_cmd mkdir -m "create trunk" "$svnrepo"/trunk &&
28 svn_cmd mkdir -m "create branches" "$svnrepo/branches" &&
29 svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
34 svn_cmd commit -m "a" &&
35 svn_cmd cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
36 svn_cmd switch "$svnrepo"/branches/branch1 &&
39 svn_cmd commit -m b &&
40 svn_cmd switch "$svnrepo"/trunk &&
43 svn_cmd commit -m c &&
45 svn_cmd merge "$svnrepo"/branches/branch1 &&
51 test_expect_success
'fetch to merge-base (a)' '
52 git svn init -s "$svnrepo" &&
53 git svn fetch --revision BASE:3
56 # git svn rebase looses the merge commit
58 # ... a - b - m <- trunk
62 test_expect_success
'rebase looses SVN merge (m)' '
65 test 1 = $(git cat-file -p main|grep parent|wc -l)
68 # git svn fetch creates correct history with merge commit
70 # ... a - b - m <- trunk
74 test_expect_success
'reset and fetch gets the SVN merge (m) correctly' '
76 git reset --hard origin/trunk &&
78 test 2 = $(git cat-file -p origin/trunk|grep parent|wc -l)