gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export
[git/jrn.git] / t / t9101-git-svn-props.sh
bloba5a235f100709f503887e9a69c5b510e0b04534f
1 #!/bin/sh
3 # Copyright (c) 2006 Eric Wong
6 test_description='git-svn property tests'
7 . ./lib-git-svn.sh
9 mkdir import
11 a_crlf=
12 a_lf=
13 a_cr=
14 a_ne_crlf=
15 a_ne_lf=
16 a_ne_cr=
17 a_empty=
18 a_empty_lf=
19 a_empty_cr=
20 a_empty_crlf=
22 cd import
23 cat >> kw.c <<\EOF
24 /* Somebody prematurely put a keyword into this file */
25 /* $Id$ */
26 EOF
28 printf "Hello\r\nWorld\r\n" > crlf
29 a_crlf=`git-hash-object -w crlf`
30 printf "Hello\rWorld\r" > cr
31 a_cr=`git-hash-object -w cr`
32 printf "Hello\nWorld\n" > lf
33 a_lf=`git-hash-object -w lf`
35 printf "Hello\r\nWorld" > ne_crlf
36 a_ne_crlf=`git-hash-object -w ne_crlf`
37 printf "Hello\nWorld" > ne_lf
38 a_ne_lf=`git-hash-object -w ne_lf`
39 printf "Hello\rWorld" > ne_cr
40 a_ne_cr=`git-hash-object -w ne_cr`
42 touch empty
43 a_empty=`git-hash-object -w empty`
44 printf "\n" > empty_lf
45 a_empty_lf=`git-hash-object -w empty_lf`
46 printf "\r" > empty_cr
47 a_empty_cr=`git-hash-object -w empty_cr`
48 printf "\r\n" > empty_crlf
49 a_empty_crlf=`git-hash-object -w empty_crlf`
51 svn import -m 'import for git-svn' . "$svnrepo" >/dev/null
52 cd ..
54 rm -rf import
55 test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
56 test_expect_success 'setup some commits to svn' \
57 'cd test_wc &&
58 echo Greetings >> kw.c &&
59 svn commit -m "Not yet an Id" &&
60 svn up &&
61 echo Hello world >> kw.c &&
62 svn commit -m "Modified file, but still not yet an Id" &&
63 svn up &&
64 svn propset svn:keywords Id kw.c &&
65 svn commit -m "Propset Id" &&
66 svn up &&
67 cd ..'
69 test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
70 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
72 name='test svn:keywords ignoring'
73 test_expect_success "$name" \
74 'git checkout -b mybranch remotes/git-svn &&
75 echo Hi again >> kw.c &&
76 git commit -a -m "test keywoards ignoring" &&
77 git-svn commit remotes/git-svn..mybranch &&
78 git pull . remotes/git-svn'
80 expect='/* $Id$ */'
81 got="`sed -ne 2p kw.c`"
82 test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"
84 test_expect_success "propset CR on crlf files" \
85 'cd test_wc &&
86 svn propset svn:eol-style CR empty &&
87 svn propset svn:eol-style CR crlf &&
88 svn propset svn:eol-style CR ne_crlf &&
89 svn commit -m "propset CR on crlf files" &&
90 svn up &&
91 cd ..'
93 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
94 "git-svn fetch &&
95 git pull . remotes/git-svn &&
96 svn co $svnrepo new_wc"
98 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
100 test_expect_success "Comparing $i" "cmp $i new_wc/$i"
101 done
104 cd test_wc
105 printf '$Id$\rHello\rWorld\r' > cr
106 printf '$Id$\rHello\rWorld' > ne_cr
107 a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git-hash-object --stdin`
108 a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git-hash-object --stdin`
109 test_expect_success 'Set CRLF on cr files' \
110 'svn propset svn:eol-style CRLF cr &&
111 svn propset svn:eol-style CRLF ne_cr &&
112 svn propset svn:keywords Id cr &&
113 svn propset svn:keywords Id ne_cr &&
114 svn commit -m "propset CRLF on cr files" &&
115 svn up'
116 cd ..
117 test_expect_success 'fetch and pull latest from svn' \
118 'git-svn fetch && git pull . remotes/git-svn'
120 b_cr="`git-hash-object cr`"
121 b_ne_cr="`git-hash-object ne_cr`"
123 test_expect_success 'CRLF + $Id$' "test '$a_cr' = '$b_cr'"
124 test_expect_success 'CRLF + $Id$ (no newline)' "test '$a_ne_cr' = '$b_ne_cr'"
126 test_done