builtin/gc.c: ignore cruft packs with `--keep-largest-pack`
[alt-git.git] / t / t9163-git-svn-reset-clears-caches.sh
blob978eb62ff4fa9c059c0c0bbcbb4b510e1bc7b6d4
1 #!/bin/sh
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
10 . ./lib-git-svn.sh
12 svn_ver="$(svn --version --quiet)"
13 case $svn_ver in
14 0.* | 1.[0-4].*)
15 skip_all="skipping git-svn test - SVN too old ($svn_ver)"
16 test_done
18 esac
20 # ... a - b - m <- trunk
21 # \ /
22 # ... c <- branch1
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" &&
31 cd "$SVN_TREE" &&
32 touch foo &&
33 svn_cmd add foo &&
34 svn_cmd commit -m "a" &&
35 svn_cmd cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
36 svn_cmd switch "$svnrepo"/branches/branch1 &&
37 touch bar &&
38 svn_cmd add bar &&
39 svn_cmd commit -m b &&
40 svn_cmd switch "$svnrepo"/trunk &&
41 touch baz &&
42 svn_cmd add baz &&
43 svn_cmd commit -m c &&
44 svn_cmd up &&
45 svn_cmd merge "$svnrepo"/branches/branch1 &&
46 svn_cmd commit -m "m"
47 ) &&
48 rm -rf "$SVN_TREE"
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
59 # \
60 # ... c
62 test_expect_success 'rebase looses SVN merge (m)' '
63 git svn rebase &&
64 git svn fetch &&
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
71 # \ /
72 # ... c <- branch1
74 test_expect_success 'reset and fetch gets the SVN merge (m) correctly' '
75 git svn reset -r 3 &&
76 git reset --hard origin/trunk &&
77 git svn fetch &&
78 test 2 = $(git cat-file -p origin/trunk|grep parent|wc -l)
81 test_done