]>
Commit | Line | Data |
---|---|---|
61b472ed PB |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2012 Peter Baumann | |
4 | # | |
5 | ||
6 | test_description='git svn reset clears memoized caches' | |
7 | . ./lib-git-svn.sh | |
8 | ||
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 | |
14 | ;; | |
15 | esac | |
16 | ||
17 | # ... a - b - m <- trunk | |
18 | # \ / | |
19 | # ... c <- branch1 | |
20 | # | |
21 | # SVN Commits not interesting for this test are abbreviated with "..." | |
22 | # | |
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" && | |
27 | ( | |
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" | |
46 | ' | |
47 | ||
48 | test_expect_success 'fetch to merge-base (a)' ' | |
49 | git svn init -s "$svnrepo" && | |
50 | git svn fetch --revision BASE:3 | |
51 | ' | |
52 | ||
53 | # git svn rebase looses the merge commit | |
54 | # | |
55 | # ... a - b - m <- trunk | |
56 | # \ | |
57 | # ... c | |
58 | # | |
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) | |
63 | ' | |
64 | ||
65 | # git svn fetch creates correct history with merge commit | |
66 | # | |
67 | # ... a - b - m <- trunk | |
68 | # \ / | |
69 | # ... c <- branch1 | |
70 | # | |
71 | test_expect_success 'reset and fetch gets the SVN merge (m) correctly' ' | |
72 | git svn reset -r 3 && | |
73 | git reset --hard trunk && | |
74 | git svn fetch && | |
75 | test 2 = $(git cat-file -p trunk|grep parent|wc -l) | |
76 | ' | |
77 | ||
78 | test_done |