]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9163-git-svn-reset-clears-caches.sh
Merge branch 'tb/make-indent-conditional-with-non-spaces'
[thirdparty/git.git] / t / t9163-git-svn-reset-clears-caches.sh
CommitLineData
61b472ed
PB
1#!/bin/sh
2#
3# Copyright (c) 2012 Peter Baumann
4#
5
6test_description='git svn reset clears memoized caches'
a881baa2 7GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
8export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
61b472ed
PB
10. ./lib-git-svn.sh
11
12svn_ver="$(svn --version --quiet)"
13case $svn_ver in
140.* | 1.[0-4].*)
15 skip_all="skipping git-svn test - SVN too old ($svn_ver)"
16 test_done
17 ;;
18esac
19
20# ... a - b - m <- trunk
21# \ /
22# ... c <- branch1
23#
24# SVN Commits not interesting for this test are abbreviated with "..."
25#
26test_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" &&
30 (
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"
49'
50
51test_expect_success 'fetch to merge-base (a)' '
52 git svn init -s "$svnrepo" &&
53 git svn fetch --revision BASE:3
54'
55
56# git svn rebase looses the merge commit
57#
58# ... a - b - m <- trunk
59# \
60# ... c
61#
62test_expect_success 'rebase looses SVN merge (m)' '
63 git svn rebase &&
64 git svn fetch &&
a881baa2 65 test 1 = $(git cat-file -p main|grep parent|wc -l)
61b472ed
PB
66'
67
68# git svn fetch creates correct history with merge commit
69#
70# ... a - b - m <- trunk
71# \ /
72# ... c <- branch1
73#
74test_expect_success 'reset and fetch gets the SVN merge (m) correctly' '
75 git svn reset -r 3 &&
fe191fca 76 git reset --hard origin/trunk &&
61b472ed 77 git svn fetch &&
fe191fca 78 test 2 = $(git cat-file -p origin/trunk|grep parent|wc -l)
61b472ed
PB
79'
80
81test_done