added index caching
[git/mingw/4msysgit/wingit-dll.git] / t / t9116-git-svn-log.sh
blobfd6d1d20463f2a4de1bd8ed739c0e977921e037c
1 #!/bin/sh
3 # Copyright (c) 2007 Eric Wong
6 test_description='git svn log tests'
7 . ./lib-git-svn.sh
9 test_expect_success 'setup repository and import' '
10 mkdir import &&
11 cd import &&
12 for i in trunk branches/a branches/b \
13 tags/0.1 tags/0.2 tags/0.3; do
14 mkdir -p $i && \
15 echo hello >> $i/README || exit 1
16 done && \
17 svn import -m test . "$svnrepo"
18 cd .. &&
19 git svn init "$svnrepo" -T trunk -b branches -t tags &&
20 git svn fetch &&
21 git reset --hard trunk &&
22 echo bye >> README &&
23 git commit -a -m bye &&
24 git svn dcommit &&
25 git reset --hard a &&
26 echo why >> FEEDME &&
27 git update-index --add FEEDME &&
28 git commit -m feedme &&
29 git svn dcommit &&
30 git reset --hard trunk &&
31 echo aye >> README &&
32 git commit -a -m aye &&
33 git svn dcommit &&
34 git reset --hard b &&
35 echo spy >> README &&
36 git commit -a -m spy &&
37 echo try >> README &&
38 git commit -a -m try &&
39 git svn dcommit
42 test_expect_success 'run log' "
43 git reset --hard a &&
44 git svn log -r2 trunk | grep ^r2 &&
45 git svn log -r4 trunk | grep ^r4 &&
46 git svn log -r3 | grep ^r3
49 test_expect_success 'run log against a from trunk' "
50 git reset --hard trunk &&
51 git svn log -r3 a | grep ^r3
54 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
56 test_expect_success 'test ascending revision range' "
57 git reset --hard trunk &&
58 git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
61 printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1
63 test_expect_success 'test descending revision range' "
64 git reset --hard trunk &&
65 git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 -
68 printf 'r1 \nr2 \n' > expected-range-r1-r2
70 test_expect_success 'test ascending revision range with unreachable revision' "
71 git reset --hard trunk &&
72 git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 -
75 printf 'r2 \nr1 \n' > expected-range-r2-r1
77 test_expect_success 'test descending revision range with unreachable revision' "
78 git reset --hard trunk &&
79 git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 -
82 printf 'r2 \n' > expected-range-r2
84 test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' "
85 git reset --hard trunk &&
86 git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
89 test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' "
90 git reset --hard trunk &&
91 git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 -
94 printf 'r4 \n' > expected-range-r4
96 test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' "
97 git reset --hard trunk &&
98 git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
101 test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' "
102 git reset --hard trunk &&
103 git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
106 printf -- '------------------------------------------------------------------------\n' > expected-separator
108 test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' "
109 git reset --hard trunk &&
110 git svn log -r 5:6 | test_cmp expected-separator -
113 test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' "
114 git reset --hard trunk &&
115 git svn log -r 6:5 | test_cmp expected-separator -
118 test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' "
119 git reset --hard trunk &&
120 git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
123 test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' "
124 git reset --hard trunk &&
125 git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 -
128 test_done